2002-06-12 23:13:12 +02:00
|
|
|
/* Copyright (C) 1995-2002 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
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2003-03-25 13:46:10 +01:00
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
2002-06-12 23:13:12 +02:00
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
This file contains the implementation of prepare and executes.
|
|
|
|
|
|
|
|
Prepare:
|
|
|
|
|
2002-11-27 03:51:38 +01:00
|
|
|
- Server gets the query from client with command 'COM_PREPARE';
|
|
|
|
in the following format:
|
|
|
|
[COM_PREPARE:1] [query]
|
2002-06-12 23:13:12 +02:00
|
|
|
- Parse the query and recognize any parameter markers '?' and
|
2002-11-27 03:51:38 +01:00
|
|
|
store its information list in lex->param_list
|
|
|
|
- Allocate a new statement for this prepare; and keep this in
|
|
|
|
'thd->prepared_statements' pool.
|
2002-06-12 23:13:12 +02:00
|
|
|
- Without executing the query, return back to client the total
|
|
|
|
number of parameters along with result-set metadata information
|
2002-11-27 03:51:38 +01:00
|
|
|
(if any) in the following format:
|
2003-01-20 23:00:50 +01:00
|
|
|
[STMT_ID:4]
|
|
|
|
[Column_count:2]
|
|
|
|
[Param_count:2]
|
|
|
|
[Columns meta info] (if Column_count > 0)
|
|
|
|
[Params meta info] (if Param_count > 0 ) (TODO : 4.1.1)
|
2002-06-12 23:13:12 +02:00
|
|
|
|
|
|
|
Prepare-execute:
|
|
|
|
|
|
|
|
- Server gets the command 'COM_EXECUTE' to execute the
|
2002-11-22 19:04:42 +01:00
|
|
|
previously prepared query. If there is any param markers; then client
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
will send the data in the following format:
|
2002-11-27 03:51:38 +01:00
|
|
|
[COM_EXECUTE:1]
|
|
|
|
[STMT_ID:4]
|
|
|
|
[NULL_BITS:(param_count+7)/8)]
|
|
|
|
[TYPES_SUPPLIED_BY_CLIENT(0/1):1]
|
|
|
|
[[length]data]
|
|
|
|
[[length]data] .. [[length]data].
|
|
|
|
(Note: Except for string/binary types; all other types will not be
|
|
|
|
supplied with length field)
|
2002-11-22 19:04:42 +01:00
|
|
|
- Replace the param items with this new data. If it is a first execute
|
|
|
|
or types altered by client; then setup the conversion routines.
|
2002-06-12 23:13:12 +02:00
|
|
|
- Execute the query without re-parsing and send back the results
|
|
|
|
to client
|
|
|
|
|
|
|
|
Long data handling:
|
2002-11-27 03:51:38 +01:00
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
- Server gets the long data in pieces with command type 'COM_LONG_DATA'.
|
|
|
|
- The packet recieved will have the format as:
|
2004-05-25 17:52:05 +02:00
|
|
|
[COM_LONG_DATA:1][STMT_ID:4][parameter_number:2][data]
|
|
|
|
- data from the packet is appended to long data value buffer for this
|
|
|
|
placeholder.
|
2002-10-02 12:33:08 +02:00
|
|
|
- It's up to the client to check for read data ended. The server doesn't
|
2002-11-27 03:51:38 +01:00
|
|
|
care; and also server doesn't notify to the client that it got the
|
|
|
|
data or not; if there is any error; then during execute; the error
|
|
|
|
will be returned
|
2002-10-02 12:33:08 +02:00
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
#include "mysql_priv.h"
|
|
|
|
#include "sql_acl.h"
|
2003-01-18 21:58:19 +01:00
|
|
|
#include "sql_select.h" // for JOIN
|
2002-10-02 12:33:08 +02:00
|
|
|
#include <m_ctype.h> // for isspace()
|
2003-05-23 15:32:31 +02:00
|
|
|
#include "sp_head.h"
|
2003-12-20 00:16:10 +01:00
|
|
|
#ifdef EMBEDDED_LIBRARY
|
|
|
|
/* include MYSQL_BIND headers */
|
|
|
|
#include <mysql.h>
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
#else
|
|
|
|
#include <mysql_com.h>
|
2003-12-20 00:16:10 +01:00
|
|
|
#endif
|
2002-06-12 23:13:12 +02:00
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
/******************************************************************************
|
|
|
|
Prepared_statement: statement which can contain placeholders
|
|
|
|
******************************************************************************/
|
2003-04-04 19:33:17 +02:00
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
class Prepared_statement: public Statement
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
THD *thd;
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
Item_param **param_array;
|
2003-12-20 00:16:10 +01:00
|
|
|
uint param_count;
|
|
|
|
uint last_errno;
|
|
|
|
char last_error[MYSQL_ERRMSG_SIZE];
|
|
|
|
#ifndef EMBEDDED_LIBRARY
|
2004-03-15 18:20:47 +01:00
|
|
|
bool (*set_params)(Prepared_statement *st, uchar *data, uchar *data_end,
|
2004-05-24 19:08:22 +02:00
|
|
|
uchar *read_pos, String *expanded_query);
|
2003-10-01 13:44:57 +02:00
|
|
|
#else
|
2004-05-24 19:08:22 +02:00
|
|
|
bool (*set_params_data)(Prepared_statement *st, String *expanded_query);
|
2003-10-01 13:44:57 +02:00
|
|
|
#endif
|
2004-04-05 17:43:37 +02:00
|
|
|
bool (*set_params_from_vars)(Prepared_statement *stmt,
|
2004-05-24 19:08:22 +02:00
|
|
|
List<LEX_STRING>& varnames,
|
|
|
|
String *expanded_query);
|
2003-12-20 00:16:10 +01:00
|
|
|
public:
|
|
|
|
Prepared_statement(THD *thd_arg);
|
|
|
|
virtual ~Prepared_statement();
|
2004-06-01 15:27:40 +02:00
|
|
|
void setup_set_params();
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
virtual Item_arena::Type type() const;
|
2003-12-20 00:16:10 +01:00
|
|
|
};
|
2003-10-01 13:44:57 +02:00
|
|
|
|
2004-06-07 22:43:03 +02:00
|
|
|
static void execute_stmt(THD *thd, Prepared_statement *stmt,
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
String *expanded_query);
|
2002-10-02 12:33:08 +02:00
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
/******************************************************************************
|
|
|
|
Implementation
|
|
|
|
******************************************************************************/
|
2002-10-02 12:33:08 +02:00
|
|
|
|
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
inline bool is_param_null(const uchar *pos, ulong param_no)
|
2002-10-02 12:33:08 +02:00
|
|
|
{
|
2003-12-20 00:16:10 +01:00
|
|
|
return pos[param_no/8] & (1 << (param_no & 7));
|
2002-10-02 12:33:08 +02:00
|
|
|
}
|
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
enum { STMT_QUERY_LOG_LENGTH= 8192 };
|
2002-10-02 12:33:08 +02:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
enum enum_send_error { DONT_SEND_ERROR= 0, SEND_ERROR };
|
2002-10-02 12:33:08 +02:00
|
|
|
|
|
|
|
/*
|
2003-12-20 00:16:10 +01:00
|
|
|
Seek prepared statement in statement map by id: returns zero if statement
|
|
|
|
was not found, pointer otherwise.
|
2002-10-02 12:33:08 +02:00
|
|
|
*/
|
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
static Prepared_statement *
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
find_prepared_statement(THD *thd, ulong id, const char *where,
|
|
|
|
enum enum_send_error se)
|
2003-12-20 00:16:10 +01:00
|
|
|
{
|
|
|
|
Statement *stmt= thd->stmt_map.find(id);
|
|
|
|
|
2004-08-31 12:07:02 +02:00
|
|
|
if (stmt == 0 || stmt->type() != Item_arena::PREPARED_STATEMENT)
|
2003-12-20 00:16:10 +01:00
|
|
|
{
|
2004-05-21 02:27:50 +02:00
|
|
|
char llbuf[22];
|
|
|
|
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), 22, llstr(id, llbuf), where);
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
if (se == SEND_ERROR)
|
|
|
|
send_error(thd);
|
2003-12-20 00:16:10 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return (Prepared_statement *) stmt;
|
2002-10-02 12:33:08 +02:00
|
|
|
}
|
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
/*
|
|
|
|
Send prepared stmt info to client after prepare
|
|
|
|
*/
|
|
|
|
|
2003-09-12 16:35:34 +02:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
2003-12-20 00:16:10 +01:00
|
|
|
static bool send_prep_stmt(Prepared_statement *stmt, uint columns)
|
2002-10-02 12:33:08 +02:00
|
|
|
{
|
2003-12-20 00:16:10 +01:00
|
|
|
NET *net= &stmt->thd->net;
|
2003-04-17 01:47:01 +02:00
|
|
|
char buff[9];
|
2004-11-03 11:39:38 +01:00
|
|
|
DBUG_ENTER("send_prep_stmt");
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
buff[0]= 0; /* OK packet indicator */
|
2003-12-20 00:16:10 +01:00
|
|
|
int4store(buff+1, stmt->id);
|
2003-04-17 01:47:01 +02:00
|
|
|
int2store(buff+5, columns);
|
|
|
|
int2store(buff+7, stmt->param_count);
|
2004-03-31 00:27:49 +02:00
|
|
|
/*
|
|
|
|
Send types and names of placeholders to the client
|
|
|
|
XXX: fix this nasty upcast from List<Item_param> to List<Item>
|
|
|
|
*/
|
2004-11-03 11:39:38 +01:00
|
|
|
DBUG_RETURN(my_net_write(net, buff, sizeof(buff)) ||
|
|
|
|
(stmt->param_count &&
|
|
|
|
stmt->thd->protocol_simple.send_fields((List<Item> *)
|
|
|
|
&stmt->lex->param_list,
|
|
|
|
Protocol::SEND_EOF)) ||
|
|
|
|
net_flush(net));
|
2003-09-12 16:35:34 +02:00
|
|
|
}
|
2002-12-16 14:33:29 +01:00
|
|
|
#else
|
2003-12-20 00:16:10 +01:00
|
|
|
static bool send_prep_stmt(Prepared_statement *stmt,
|
|
|
|
uint columns __attribute__((unused)))
|
2003-09-12 16:35:34 +02:00
|
|
|
{
|
2003-09-16 13:06:25 +02:00
|
|
|
THD *thd= stmt->thd;
|
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
thd->client_stmt_id= stmt->id;
|
2003-09-16 13:06:25 +02:00
|
|
|
thd->client_param_count= stmt->param_count;
|
2003-10-06 09:09:20 +02:00
|
|
|
thd->net.last_errno= 0;
|
2003-09-12 16:35:34 +02:00
|
|
|
|
2003-09-16 13:06:25 +02:00
|
|
|
return 0;
|
2002-10-02 12:33:08 +02:00
|
|
|
}
|
2003-11-26 22:16:34 +01:00
|
|
|
#endif /*!EMBEDDED_LIBRARY*/
|
2002-10-02 12:33:08 +02:00
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
|
|
|
|
/*
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
Read the length of the parameter data and return back to
|
|
|
|
caller by positing the pointer to param data.
|
2002-06-12 23:13:12 +02:00
|
|
|
*/
|
|
|
|
|
2003-10-01 13:44:57 +02:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
2004-03-15 18:20:47 +01:00
|
|
|
static ulong get_param_length(uchar **packet, ulong len)
|
2002-06-12 23:13:12 +02:00
|
|
|
{
|
|
|
|
reg1 uchar *pos= *packet;
|
2004-03-15 18:20:47 +01:00
|
|
|
if (len < 1)
|
|
|
|
return 0;
|
2002-06-12 23:13:12 +02:00
|
|
|
if (*pos < 251)
|
|
|
|
{
|
|
|
|
(*packet)++;
|
|
|
|
return (ulong) *pos;
|
|
|
|
}
|
2004-03-15 18:20:47 +01:00
|
|
|
if (len < 3)
|
|
|
|
return 0;
|
2002-06-12 23:13:12 +02:00
|
|
|
if (*pos == 252)
|
|
|
|
{
|
|
|
|
(*packet)+=3;
|
|
|
|
return (ulong) uint2korr(pos+1);
|
|
|
|
}
|
2004-03-15 18:20:47 +01:00
|
|
|
if (len < 4)
|
|
|
|
return 0;
|
2002-06-12 23:13:12 +02:00
|
|
|
if (*pos == 253)
|
|
|
|
{
|
|
|
|
(*packet)+=4;
|
|
|
|
return (ulong) uint3korr(pos+1);
|
|
|
|
}
|
2004-03-15 18:20:47 +01:00
|
|
|
if (len < 5)
|
|
|
|
return 0;
|
2002-06-12 23:13:12 +02:00
|
|
|
(*packet)+=9; // Must be 254 when here
|
2004-06-05 22:33:16 +02:00
|
|
|
/*
|
|
|
|
In our client-server protocol all numbers bigger than 2^24
|
|
|
|
stored as 8 bytes with uint8korr. Here we always know that
|
|
|
|
parameter length is less than 2^4 so don't look at the second
|
|
|
|
4 bytes. But still we need to obey the protocol hence 9 in the
|
|
|
|
assignment above.
|
|
|
|
*/
|
2002-06-12 23:13:12 +02:00
|
|
|
return (ulong) uint4korr(pos+1);
|
|
|
|
}
|
2003-10-01 13:44:57 +02:00
|
|
|
#else
|
2004-03-15 18:20:47 +01:00
|
|
|
#define get_param_length(packet, len) len
|
2003-10-01 13:44:57 +02:00
|
|
|
#endif /*!EMBEDDED_LIBRARY*/
|
|
|
|
|
2002-11-22 19:04:42 +01:00
|
|
|
/*
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
Data conversion routines
|
|
|
|
SYNOPSIS
|
|
|
|
set_param_xx()
|
|
|
|
param parameter item
|
|
|
|
pos input data buffer
|
|
|
|
len length of data in the buffer
|
2002-11-22 19:04:42 +01:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
All these functions read the data from pos, convert it to requested type
|
|
|
|
and assign to param; pos is advanced to predefined length.
|
2002-11-22 19:04:42 +01:00
|
|
|
|
|
|
|
Make a note that the NULL handling is examined at first execution
|
|
|
|
(i.e. when input types altered) and for all subsequent executions
|
|
|
|
we don't read any values for this.
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
RETURN VALUE
|
|
|
|
none
|
2002-06-12 23:13:12 +02:00
|
|
|
*/
|
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
static void set_param_tiny(Item_param *param, uchar **pos, ulong len)
|
2002-06-12 23:13:12 +02:00
|
|
|
{
|
2004-03-15 18:20:47 +01:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
|
|
|
if (len < 1)
|
|
|
|
return;
|
|
|
|
#endif
|
2004-04-30 01:00:19 +02:00
|
|
|
int8 value= (int8) **pos;
|
|
|
|
param->set_int(param->unsigned_flag ? (longlong) ((uint8) value) :
|
2004-05-25 00:03:49 +02:00
|
|
|
(longlong) value, 4);
|
2002-11-22 19:04:42 +01:00
|
|
|
*pos+= 1;
|
|
|
|
}
|
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
static void set_param_short(Item_param *param, uchar **pos, ulong len)
|
2002-11-22 19:04:42 +01:00
|
|
|
{
|
2004-05-25 00:03:49 +02:00
|
|
|
int16 value;
|
2004-03-15 18:20:47 +01:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
|
|
|
if (len < 2)
|
|
|
|
return;
|
2004-05-25 00:03:49 +02:00
|
|
|
value= sint2korr(*pos);
|
2004-05-18 16:13:21 +02:00
|
|
|
#else
|
|
|
|
shortget(value, *pos);
|
2004-03-15 18:20:47 +01:00
|
|
|
#endif
|
2004-04-30 01:00:19 +02:00
|
|
|
param->set_int(param->unsigned_flag ? (longlong) ((uint16) value) :
|
2004-05-25 00:03:49 +02:00
|
|
|
(longlong) value, 6);
|
2002-11-22 19:04:42 +01:00
|
|
|
*pos+= 2;
|
|
|
|
}
|
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
static void set_param_int32(Item_param *param, uchar **pos, ulong len)
|
2002-11-22 19:04:42 +01:00
|
|
|
{
|
2004-05-25 00:03:49 +02:00
|
|
|
int32 value;
|
2004-03-15 18:20:47 +01:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
|
|
|
if (len < 4)
|
|
|
|
return;
|
2004-05-25 00:03:49 +02:00
|
|
|
value= sint4korr(*pos);
|
2004-05-18 16:13:21 +02:00
|
|
|
#else
|
|
|
|
longget(value, *pos);
|
2004-03-15 18:20:47 +01:00
|
|
|
#endif
|
2004-04-30 01:00:19 +02:00
|
|
|
param->set_int(param->unsigned_flag ? (longlong) ((uint32) value) :
|
2004-05-25 00:03:49 +02:00
|
|
|
(longlong) value, 11);
|
2002-11-22 19:04:42 +01:00
|
|
|
*pos+= 4;
|
|
|
|
}
|
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
static void set_param_int64(Item_param *param, uchar **pos, ulong len)
|
2002-11-22 19:04:42 +01:00
|
|
|
{
|
2004-05-25 00:03:49 +02:00
|
|
|
longlong value;
|
2004-03-15 18:20:47 +01:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
|
|
|
if (len < 8)
|
|
|
|
return;
|
2004-05-25 00:03:49 +02:00
|
|
|
value= (longlong) sint8korr(*pos);
|
2004-05-18 16:13:21 +02:00
|
|
|
#else
|
|
|
|
longlongget(value, *pos);
|
2004-03-15 18:20:47 +01:00
|
|
|
#endif
|
2004-05-25 00:03:49 +02:00
|
|
|
param->set_int(value, 21);
|
2002-11-22 19:04:42 +01:00
|
|
|
*pos+= 8;
|
|
|
|
}
|
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
static void set_param_float(Item_param *param, uchar **pos, ulong len)
|
2002-11-22 19:04:42 +01:00
|
|
|
{
|
2004-03-15 18:20:47 +01:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
|
|
|
if (len < 4)
|
|
|
|
return;
|
|
|
|
#endif
|
2002-11-22 19:04:42 +01:00
|
|
|
float data;
|
|
|
|
float4get(data,*pos);
|
|
|
|
param->set_double((double) data);
|
|
|
|
*pos+= 4;
|
|
|
|
}
|
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
static void set_param_double(Item_param *param, uchar **pos, ulong len)
|
2002-11-22 19:04:42 +01:00
|
|
|
{
|
2004-03-15 18:20:47 +01:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
|
|
|
if (len < 8)
|
|
|
|
return;
|
|
|
|
#endif
|
2002-11-22 19:04:42 +01:00
|
|
|
double data;
|
|
|
|
float8get(data,*pos);
|
|
|
|
param->set_double((double) data);
|
|
|
|
*pos+= 8;
|
|
|
|
}
|
|
|
|
|
2004-05-15 14:07:44 +02:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
2004-09-02 18:16:01 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
Read date/time/datetime parameter values from network (binary
|
|
|
|
protocol). See writing counterparts of these functions in
|
|
|
|
libmysql.c (store_param_{time,date,datetime}).
|
|
|
|
*/
|
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
static void set_param_time(Item_param *param, uchar **pos, ulong len)
|
2003-01-24 07:32:39 +01:00
|
|
|
{
|
2004-09-02 18:16:01 +02:00
|
|
|
MYSQL_TIME tm;
|
|
|
|
ulong length= get_param_length(pos, len);
|
2003-01-24 07:32:39 +01:00
|
|
|
|
2004-09-02 18:16:01 +02:00
|
|
|
if (length >= 8)
|
2003-01-24 07:32:39 +01:00
|
|
|
{
|
|
|
|
uchar *to= *pos;
|
2004-09-02 18:16:01 +02:00
|
|
|
uint day;
|
2003-01-24 07:32:39 +01:00
|
|
|
|
2004-06-09 01:21:50 +02:00
|
|
|
tm.neg= (bool) to[0];
|
|
|
|
day= (uint) sint4korr(to+1);
|
2004-05-25 00:03:49 +02:00
|
|
|
/*
|
|
|
|
Note, that though ranges of hour, minute and second are not checked
|
|
|
|
here we rely on them being < 256: otherwise
|
|
|
|
we'll get buffer overflow in make_{date,time} functions,
|
|
|
|
which are called when time value is converted to string.
|
|
|
|
*/
|
|
|
|
tm.hour= (uint) to[5] + day * 24;
|
2003-01-24 07:32:39 +01:00
|
|
|
tm.minute= (uint) to[6];
|
|
|
|
tm.second= (uint) to[7];
|
2004-06-09 01:21:50 +02:00
|
|
|
tm.second_part= (length > 8) ? (ulong) sint4korr(to+8) : 0;
|
2004-05-25 00:03:49 +02:00
|
|
|
if (tm.hour > 838)
|
|
|
|
{
|
|
|
|
/* TODO: add warning 'Data truncated' here */
|
|
|
|
tm.hour= 838;
|
|
|
|
tm.minute= 59;
|
|
|
|
tm.second= 59;
|
|
|
|
}
|
|
|
|
tm.day= tm.year= tm.month= 0;
|
2003-01-24 07:32:39 +01:00
|
|
|
}
|
2004-09-02 18:16:01 +02:00
|
|
|
else
|
|
|
|
set_zero_time(&tm);
|
|
|
|
param->set_time(&tm, MYSQL_TIMESTAMP_TIME,
|
|
|
|
MAX_TIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
|
2003-01-24 07:32:39 +01:00
|
|
|
*pos+= length;
|
|
|
|
}
|
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
static void set_param_datetime(Item_param *param, uchar **pos, ulong len)
|
2003-01-24 07:32:39 +01:00
|
|
|
{
|
2004-09-02 18:16:01 +02:00
|
|
|
MYSQL_TIME tm;
|
|
|
|
ulong length= get_param_length(pos, len);
|
2004-06-09 01:21:50 +02:00
|
|
|
|
2004-09-02 18:16:01 +02:00
|
|
|
if (length >= 4)
|
2003-01-24 07:32:39 +01:00
|
|
|
{
|
|
|
|
uchar *to= *pos;
|
2004-06-09 01:21:50 +02:00
|
|
|
|
|
|
|
tm.neg= 0;
|
|
|
|
tm.year= (uint) sint2korr(to);
|
|
|
|
tm.month= (uint) to[2];
|
|
|
|
tm.day= (uint) to[3];
|
2004-05-25 00:03:49 +02:00
|
|
|
/*
|
|
|
|
Note, that though ranges of hour, minute and second are not checked
|
|
|
|
here we rely on them being < 256: otherwise
|
|
|
|
we'll get buffer overflow in make_{date,time} functions.
|
|
|
|
*/
|
2003-01-24 07:32:39 +01:00
|
|
|
if (length > 4)
|
|
|
|
{
|
|
|
|
tm.hour= (uint) to[4];
|
|
|
|
tm.minute= (uint) to[5];
|
|
|
|
tm.second= (uint) to[6];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
tm.hour= tm.minute= tm.second= 0;
|
|
|
|
|
2004-06-09 01:21:50 +02:00
|
|
|
tm.second_part= (length > 7) ? (ulong) sint4korr(to+7) : 0;
|
2003-01-24 07:32:39 +01:00
|
|
|
}
|
2004-09-02 18:16:01 +02:00
|
|
|
else
|
|
|
|
set_zero_time(&tm);
|
|
|
|
param->set_time(&tm, MYSQL_TIMESTAMP_DATETIME,
|
|
|
|
MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
|
2003-01-24 07:32:39 +01:00
|
|
|
*pos+= length;
|
|
|
|
}
|
|
|
|
|
2004-09-09 05:59:26 +02:00
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
static void set_param_date(Item_param *param, uchar **pos, ulong len)
|
2003-01-24 07:32:39 +01:00
|
|
|
{
|
2004-09-02 18:16:01 +02:00
|
|
|
MYSQL_TIME tm;
|
|
|
|
ulong length= get_param_length(pos, len);
|
|
|
|
|
|
|
|
if (length >= 4)
|
2003-01-24 07:32:39 +01:00
|
|
|
{
|
|
|
|
uchar *to= *pos;
|
2004-05-25 00:03:49 +02:00
|
|
|
/*
|
|
|
|
Note, that though ranges of hour, minute and second are not checked
|
|
|
|
here we rely on them being < 256: otherwise
|
|
|
|
we'll get buffer overflow in make_{date,time} functions.
|
|
|
|
*/
|
2003-01-28 18:24:27 +01:00
|
|
|
tm.year= (uint) sint2korr(to);
|
2003-01-24 07:32:39 +01:00
|
|
|
tm.month= (uint) to[2];
|
|
|
|
tm.day= (uint) to[3];
|
|
|
|
|
|
|
|
tm.hour= tm.minute= tm.second= 0;
|
|
|
|
tm.second_part= 0;
|
|
|
|
tm.neg= 0;
|
|
|
|
}
|
2004-09-02 18:16:01 +02:00
|
|
|
else
|
|
|
|
set_zero_time(&tm);
|
|
|
|
param->set_time(&tm, MYSQL_TIMESTAMP_DATE,
|
|
|
|
MAX_DATE_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
|
2003-01-24 07:32:39 +01:00
|
|
|
*pos+= length;
|
|
|
|
}
|
|
|
|
|
2004-05-15 14:07:44 +02:00
|
|
|
#else/*!EMBEDDED_LIBRARY*/
|
|
|
|
void set_param_time(Item_param *param, uchar **pos, ulong len)
|
|
|
|
{
|
|
|
|
MYSQL_TIME *to= (MYSQL_TIME*)*pos;
|
Fix for Bug#4030 "Client side conversion string -> date type doesn't
work (prepared statements)" and after-review fixes:
- str_to_TIME renamed to str_to_datetime to pair with str_to_time
- functions str_to_time and str_to_TIME moved to sql-common
- send_data_str now supports MYSQL_TYPE_TIME, MYSQL_TIME_DATE,
MYSQL_TIME_DATETIME types of user input buffers.
- few more comments in the client library
- a test case added.
VC++Files/libmysql/libmysql.dsp:
new file: my_time.c
VC++Files/libmysqld/libmysqld.dsp:
new file: my_time.c
VC++Files/sql/mysqld.dsp:
new file: my_time.c
include/Makefile.am:
- mysql_time.h added to the list of installed client library headers
include/mysql.h:
- declarations for MYSQL_TIME and enum_mysql_timestamp_type moved to
mysql_time.h, which is in shared use of client library and mysys.
libmysql/Makefile.shared:
- my_time.lo added to the list of libmysql objects
libmysql/libmysql.c:
Fix for bug#4030 "Client side conversion string -> date type doesn't work
(prepared statements)" and cleanup.
- added case labels for TIME/DATE/DATETIME types to send_data_str
- comments for read_binary_{date,time,datetime}, fetch_result_*, fetch_results.
libmysqld/Makefile.am:
- my_time.c added
sql-common/Makefile.am:
- my_time.c added to the list of files included into source distribution.
sql/Makefile.am:
my_time.c added to the list of mysqld sources.
sql/field.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item_timefunc.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/mysql_priv.h:
- added typedefs for TIME and timestamp_type
- removed declarations for str_to_time and str_to_TIME (now this functions
reside in mysys)
sql/mysqld.cc:
- log_10_int moved to mysys (it's used by str_to_TIME and str_to_time)
- enum values TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
sql/set_var.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/set_var.h:
- fixed timestamp_type usage to be compatible with typedef.
sql/sql_prepare.cc:
- TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
- embedded library implementation of set_param_{time,date,datetime} is
much simplier now, as MYSQL_TIME is the same as TIME.
sql/sql_yacc.yy:
- s/\<TIMESTAMP_/MYSQL_TIMESTAMP/gc
sql/structs.h:
- declarations for TIME and timestamp_type replaced with typedefs
- str_to_datetime arguments moved to mysys headers
sql/time.cc:
- str_to_time and str_to_TIME moved to mysys
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...} as these names are now
exported to client.
- str_to_TIME renamed to str_to_datetime to pair with str_to_time
- str_to_TIME_with_warn renamed accordingly
sql/tztime.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
tests/client_test.c:
- a test case for Bug#4030 "Client side conversion string -> date type
doesn't work (prepared statements)"
2004-06-24 17:08:36 +02:00
|
|
|
param->set_time(to, MYSQL_TIMESTAMP_TIME,
|
2004-05-25 00:03:49 +02:00
|
|
|
MAX_TIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
|
2004-05-15 14:07:44 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_param_datetime(Item_param *param, uchar **pos, ulong len)
|
|
|
|
{
|
|
|
|
MYSQL_TIME *to= (MYSQL_TIME*)*pos;
|
|
|
|
|
Fix for Bug#4030 "Client side conversion string -> date type doesn't
work (prepared statements)" and after-review fixes:
- str_to_TIME renamed to str_to_datetime to pair with str_to_time
- functions str_to_time and str_to_TIME moved to sql-common
- send_data_str now supports MYSQL_TYPE_TIME, MYSQL_TIME_DATE,
MYSQL_TIME_DATETIME types of user input buffers.
- few more comments in the client library
- a test case added.
VC++Files/libmysql/libmysql.dsp:
new file: my_time.c
VC++Files/libmysqld/libmysqld.dsp:
new file: my_time.c
VC++Files/sql/mysqld.dsp:
new file: my_time.c
include/Makefile.am:
- mysql_time.h added to the list of installed client library headers
include/mysql.h:
- declarations for MYSQL_TIME and enum_mysql_timestamp_type moved to
mysql_time.h, which is in shared use of client library and mysys.
libmysql/Makefile.shared:
- my_time.lo added to the list of libmysql objects
libmysql/libmysql.c:
Fix for bug#4030 "Client side conversion string -> date type doesn't work
(prepared statements)" and cleanup.
- added case labels for TIME/DATE/DATETIME types to send_data_str
- comments for read_binary_{date,time,datetime}, fetch_result_*, fetch_results.
libmysqld/Makefile.am:
- my_time.c added
sql-common/Makefile.am:
- my_time.c added to the list of files included into source distribution.
sql/Makefile.am:
my_time.c added to the list of mysqld sources.
sql/field.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item_timefunc.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/mysql_priv.h:
- added typedefs for TIME and timestamp_type
- removed declarations for str_to_time and str_to_TIME (now this functions
reside in mysys)
sql/mysqld.cc:
- log_10_int moved to mysys (it's used by str_to_TIME and str_to_time)
- enum values TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
sql/set_var.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/set_var.h:
- fixed timestamp_type usage to be compatible with typedef.
sql/sql_prepare.cc:
- TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
- embedded library implementation of set_param_{time,date,datetime} is
much simplier now, as MYSQL_TIME is the same as TIME.
sql/sql_yacc.yy:
- s/\<TIMESTAMP_/MYSQL_TIMESTAMP/gc
sql/structs.h:
- declarations for TIME and timestamp_type replaced with typedefs
- str_to_datetime arguments moved to mysys headers
sql/time.cc:
- str_to_time and str_to_TIME moved to mysys
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...} as these names are now
exported to client.
- str_to_TIME renamed to str_to_datetime to pair with str_to_time
- str_to_TIME_with_warn renamed accordingly
sql/tztime.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
tests/client_test.c:
- a test case for Bug#4030 "Client side conversion string -> date type
doesn't work (prepared statements)"
2004-06-24 17:08:36 +02:00
|
|
|
param->set_time(to, MYSQL_TIMESTAMP_DATETIME,
|
2004-05-25 00:03:49 +02:00
|
|
|
MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
|
2004-05-15 14:07:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void set_param_date(Item_param *param, uchar **pos, ulong len)
|
|
|
|
{
|
|
|
|
MYSQL_TIME *to= (MYSQL_TIME*)*pos;
|
|
|
|
|
Fix for Bug#4030 "Client side conversion string -> date type doesn't
work (prepared statements)" and after-review fixes:
- str_to_TIME renamed to str_to_datetime to pair with str_to_time
- functions str_to_time and str_to_TIME moved to sql-common
- send_data_str now supports MYSQL_TYPE_TIME, MYSQL_TIME_DATE,
MYSQL_TIME_DATETIME types of user input buffers.
- few more comments in the client library
- a test case added.
VC++Files/libmysql/libmysql.dsp:
new file: my_time.c
VC++Files/libmysqld/libmysqld.dsp:
new file: my_time.c
VC++Files/sql/mysqld.dsp:
new file: my_time.c
include/Makefile.am:
- mysql_time.h added to the list of installed client library headers
include/mysql.h:
- declarations for MYSQL_TIME and enum_mysql_timestamp_type moved to
mysql_time.h, which is in shared use of client library and mysys.
libmysql/Makefile.shared:
- my_time.lo added to the list of libmysql objects
libmysql/libmysql.c:
Fix for bug#4030 "Client side conversion string -> date type doesn't work
(prepared statements)" and cleanup.
- added case labels for TIME/DATE/DATETIME types to send_data_str
- comments for read_binary_{date,time,datetime}, fetch_result_*, fetch_results.
libmysqld/Makefile.am:
- my_time.c added
sql-common/Makefile.am:
- my_time.c added to the list of files included into source distribution.
sql/Makefile.am:
my_time.c added to the list of mysqld sources.
sql/field.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/item_timefunc.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/mysql_priv.h:
- added typedefs for TIME and timestamp_type
- removed declarations for str_to_time and str_to_TIME (now this functions
reside in mysys)
sql/mysqld.cc:
- log_10_int moved to mysys (it's used by str_to_TIME and str_to_time)
- enum values TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
sql/set_var.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
sql/set_var.h:
- fixed timestamp_type usage to be compatible with typedef.
sql/sql_prepare.cc:
- TIMESTAMP_{TIME,DATE,DATETIME} were renamed to
MYSQL_TIMESTAMP_{TIME,DATE,DATETIME}
- embedded library implementation of set_param_{time,date,datetime} is
much simplier now, as MYSQL_TIME is the same as TIME.
sql/sql_yacc.yy:
- s/\<TIMESTAMP_/MYSQL_TIMESTAMP/gc
sql/structs.h:
- declarations for TIME and timestamp_type replaced with typedefs
- str_to_datetime arguments moved to mysys headers
sql/time.cc:
- str_to_time and str_to_TIME moved to mysys
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...} as these names are now
exported to client.
- str_to_TIME renamed to str_to_datetime to pair with str_to_time
- str_to_TIME_with_warn renamed accordingly
sql/tztime.cc:
- TIMESTAMP_{TIME,DATE,DATETIME,...} renamed to
MYSQL_TIMESTAMP_{TIME,DATETIME,DATE,...}
tests/client_test.c:
- a test case for Bug#4030 "Client side conversion string -> date type
doesn't work (prepared statements)"
2004-06-24 17:08:36 +02:00
|
|
|
param->set_time(to, MYSQL_TIMESTAMP_DATE,
|
2004-05-25 00:03:49 +02:00
|
|
|
MAX_DATE_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
|
2004-05-15 14:07:44 +02:00
|
|
|
}
|
|
|
|
#endif /*!EMBEDDED_LIBRARY*/
|
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
|
|
|
|
static void set_param_str(Item_param *param, uchar **pos, ulong len)
|
2002-11-22 19:04:42 +01:00
|
|
|
{
|
2004-03-15 18:20:47 +01:00
|
|
|
ulong length= get_param_length(pos, len);
|
2004-05-25 00:03:49 +02:00
|
|
|
param->set_str((const char *)*pos, length);
|
2004-03-15 18:20:47 +01:00
|
|
|
*pos+= length;
|
2002-11-22 19:04:42 +01:00
|
|
|
}
|
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
|
|
|
|
#undef get_param_length
|
|
|
|
|
|
|
|
static void setup_one_conversion_function(THD *thd, Item_param *param,
|
|
|
|
uchar param_type)
|
2002-11-22 19:04:42 +01:00
|
|
|
{
|
2002-11-27 03:51:38 +01:00
|
|
|
switch (param_type) {
|
2004-05-25 00:03:49 +02:00
|
|
|
case MYSQL_TYPE_TINY:
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
param->set_param_func= set_param_tiny;
|
2004-05-25 00:03:49 +02:00
|
|
|
param->item_type= Item::INT_ITEM;
|
2003-01-28 18:24:27 +01:00
|
|
|
param->item_result_type= INT_RESULT;
|
2002-06-12 23:13:12 +02:00
|
|
|
break;
|
2004-05-25 00:03:49 +02:00
|
|
|
case MYSQL_TYPE_SHORT:
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
param->set_param_func= set_param_short;
|
2004-05-25 00:03:49 +02:00
|
|
|
param->item_type= Item::INT_ITEM;
|
2003-01-28 18:24:27 +01:00
|
|
|
param->item_result_type= INT_RESULT;
|
2002-06-12 23:13:12 +02:00
|
|
|
break;
|
2004-05-25 00:03:49 +02:00
|
|
|
case MYSQL_TYPE_LONG:
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
param->set_param_func= set_param_int32;
|
2004-05-25 00:03:49 +02:00
|
|
|
param->item_type= Item::INT_ITEM;
|
2003-01-28 18:24:27 +01:00
|
|
|
param->item_result_type= INT_RESULT;
|
2002-06-12 23:13:12 +02:00
|
|
|
break;
|
2004-05-25 00:03:49 +02:00
|
|
|
case MYSQL_TYPE_LONGLONG:
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
param->set_param_func= set_param_int64;
|
2004-05-25 00:03:49 +02:00
|
|
|
param->item_type= Item::INT_ITEM;
|
2003-01-28 18:24:27 +01:00
|
|
|
param->item_result_type= INT_RESULT;
|
2002-06-12 23:13:12 +02:00
|
|
|
break;
|
2004-05-25 00:03:49 +02:00
|
|
|
case MYSQL_TYPE_FLOAT:
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
param->set_param_func= set_param_float;
|
2004-05-25 00:03:49 +02:00
|
|
|
param->item_type= Item::REAL_ITEM;
|
2003-01-28 18:24:27 +01:00
|
|
|
param->item_result_type= REAL_RESULT;
|
2002-06-12 23:13:12 +02:00
|
|
|
break;
|
2004-05-25 00:03:49 +02:00
|
|
|
case MYSQL_TYPE_DOUBLE:
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
param->set_param_func= set_param_double;
|
2004-05-25 00:03:49 +02:00
|
|
|
param->item_type= Item::REAL_ITEM;
|
2003-01-28 18:24:27 +01:00
|
|
|
param->item_result_type= REAL_RESULT;
|
2002-06-12 23:13:12 +02:00
|
|
|
break;
|
2004-05-25 00:03:49 +02:00
|
|
|
case MYSQL_TYPE_TIME:
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
param->set_param_func= set_param_time;
|
2004-05-25 00:03:49 +02:00
|
|
|
param->item_type= Item::STRING_ITEM;
|
2003-01-28 18:24:27 +01:00
|
|
|
param->item_result_type= STRING_RESULT;
|
2003-01-24 07:32:39 +01:00
|
|
|
break;
|
2004-05-25 00:03:49 +02:00
|
|
|
case MYSQL_TYPE_DATE:
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
param->set_param_func= set_param_date;
|
2004-05-25 00:03:49 +02:00
|
|
|
param->item_type= Item::STRING_ITEM;
|
2003-01-28 18:24:27 +01:00
|
|
|
param->item_result_type= STRING_RESULT;
|
2003-01-24 07:32:39 +01:00
|
|
|
break;
|
2003-04-04 19:33:17 +02:00
|
|
|
case MYSQL_TYPE_DATETIME:
|
|
|
|
case MYSQL_TYPE_TIMESTAMP:
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
param->set_param_func= set_param_datetime;
|
2004-05-25 00:03:49 +02:00
|
|
|
param->item_type= Item::STRING_ITEM;
|
2003-01-28 18:24:27 +01:00
|
|
|
param->item_result_type= STRING_RESULT;
|
2003-01-24 07:32:39 +01:00
|
|
|
break;
|
2004-05-25 00:03:49 +02:00
|
|
|
case MYSQL_TYPE_TINY_BLOB:
|
|
|
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
|
|
|
case MYSQL_TYPE_LONG_BLOB:
|
|
|
|
case MYSQL_TYPE_BLOB:
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
param->set_param_func= set_param_str;
|
2004-05-25 00:03:49 +02:00
|
|
|
param->value.cs_info.character_set_client= &my_charset_bin;
|
|
|
|
param->value.cs_info.final_character_set_of_str_value= &my_charset_bin;
|
|
|
|
param->item_type= Item::STRING_ITEM;
|
2003-01-28 18:24:27 +01:00
|
|
|
param->item_result_type= STRING_RESULT;
|
2004-05-25 00:03:49 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/*
|
|
|
|
The client library ensures that we won't get any other typecodes
|
|
|
|
except typecodes above and typecodes for string types. Marking
|
|
|
|
label as 'default' lets us to handle malformed packets as well.
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
CHARSET_INFO *fromcs= thd->variables.character_set_client;
|
|
|
|
CHARSET_INFO *tocs= thd->variables.collation_connection;
|
|
|
|
uint32 dummy_offset;
|
|
|
|
|
|
|
|
param->value.cs_info.character_set_client= fromcs;
|
|
|
|
|
|
|
|
/*
|
|
|
|
Setup source and destination character sets so that they
|
|
|
|
are different only if conversion is necessary: this will
|
|
|
|
make later checks easier.
|
|
|
|
*/
|
|
|
|
param->value.cs_info.final_character_set_of_str_value=
|
|
|
|
String::needs_conversion(0, fromcs, tocs, &dummy_offset) ?
|
|
|
|
tocs : fromcs;
|
|
|
|
param->set_param_func= set_param_str;
|
|
|
|
/*
|
|
|
|
Exact value of max_length is not known unless data is converted to
|
|
|
|
charset of connection, so we have to set it later.
|
|
|
|
*/
|
|
|
|
param->item_type= Item::STRING_ITEM;
|
|
|
|
param->item_result_type= STRING_RESULT;
|
|
|
|
}
|
2002-06-12 23:13:12 +02:00
|
|
|
}
|
2004-06-09 01:21:50 +02:00
|
|
|
param->param_type= (enum enum_field_types) param_type;
|
2002-06-12 23:13:12 +02:00
|
|
|
}
|
|
|
|
|
2003-09-17 17:48:53 +02:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
2002-06-12 23:13:12 +02:00
|
|
|
/*
|
2003-04-04 19:33:17 +02:00
|
|
|
Update the parameter markers by reading data from client packet
|
|
|
|
and if binary/update log is set, generate the valid query.
|
2002-06-12 23:13:12 +02:00
|
|
|
*/
|
|
|
|
|
2004-03-15 18:20:47 +01:00
|
|
|
static bool insert_params_withlog(Prepared_statement *stmt, uchar *null_array,
|
2004-05-24 19:08:22 +02:00
|
|
|
uchar *read_pos, uchar *data_end,
|
|
|
|
String *query)
|
2003-04-04 19:33:17 +02:00
|
|
|
{
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
THD *thd= stmt->thd;
|
|
|
|
Item_param **begin= stmt->param_array;
|
|
|
|
Item_param **end= begin + stmt->param_count;
|
|
|
|
uint32 length= 0;
|
|
|
|
|
2004-05-24 19:08:22 +02:00
|
|
|
String str;
|
2003-12-20 00:16:10 +01:00
|
|
|
const String *res;
|
2003-11-27 17:14:16 +01:00
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
DBUG_ENTER("insert_params_withlog");
|
2003-11-27 17:14:16 +01:00
|
|
|
|
2004-05-24 19:08:22 +02:00
|
|
|
if (query->copy(stmt->query, stmt->query_length, default_charset_info))
|
2003-11-27 17:14:16 +01:00
|
|
|
DBUG_RETURN(1);
|
2003-04-04 19:33:17 +02:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
for (Item_param **it= begin; it < end; ++it)
|
2003-04-04 19:33:17 +02:00
|
|
|
{
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
Item_param *param= *it;
|
2004-05-25 00:03:49 +02:00
|
|
|
if (param->state != Item_param::LONG_DATA_VALUE)
|
2003-04-04 19:33:17 +02:00
|
|
|
{
|
2004-03-15 18:20:47 +01:00
|
|
|
if (is_param_null(null_array, it - begin))
|
2004-05-04 17:08:19 +02:00
|
|
|
param->set_null();
|
2003-04-04 19:33:17 +02:00
|
|
|
else
|
|
|
|
{
|
2004-03-15 18:20:47 +01:00
|
|
|
if (read_pos >= data_end)
|
|
|
|
DBUG_RETURN(1);
|
|
|
|
param->set_param_func(param, &read_pos, data_end - read_pos);
|
2003-04-04 19:33:17 +02:00
|
|
|
}
|
|
|
|
}
|
2004-05-25 00:03:49 +02:00
|
|
|
res= param->query_val_str(&str);
|
|
|
|
if (param->convert_str_value(thd))
|
|
|
|
DBUG_RETURN(1); /* out of memory */
|
|
|
|
|
2004-05-24 19:08:22 +02:00
|
|
|
if (query->replace(param->pos_in_query+length, 1, *res))
|
2003-04-04 19:33:17 +02:00
|
|
|
DBUG_RETURN(1);
|
|
|
|
|
|
|
|
length+= res->length()-1;
|
|
|
|
}
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
}
|
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
|
2004-03-15 18:20:47 +01:00
|
|
|
static bool insert_params(Prepared_statement *stmt, uchar *null_array,
|
2004-05-24 19:08:22 +02:00
|
|
|
uchar *read_pos, uchar *data_end,
|
|
|
|
String *expanded_query)
|
2003-04-04 19:33:17 +02:00
|
|
|
{
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
Item_param **begin= stmt->param_array;
|
|
|
|
Item_param **end= begin + stmt->param_count;
|
2003-12-20 00:16:10 +01:00
|
|
|
|
|
|
|
DBUG_ENTER("insert_params");
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
for (Item_param **it= begin; it < end; ++it)
|
2003-04-04 19:33:17 +02:00
|
|
|
{
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
Item_param *param= *it;
|
2004-05-25 00:03:49 +02:00
|
|
|
if (param->state != Item_param::LONG_DATA_VALUE)
|
2003-04-04 19:33:17 +02:00
|
|
|
{
|
2004-03-15 18:20:47 +01:00
|
|
|
if (is_param_null(null_array, it - begin))
|
2004-05-04 17:08:19 +02:00
|
|
|
param->set_null();
|
2003-04-04 19:33:17 +02:00
|
|
|
else
|
|
|
|
{
|
2004-03-15 18:20:47 +01:00
|
|
|
if (read_pos >= data_end)
|
|
|
|
DBUG_RETURN(1);
|
|
|
|
param->set_param_func(param, &read_pos, data_end - read_pos);
|
2003-04-04 19:33:17 +02:00
|
|
|
}
|
|
|
|
}
|
2004-05-25 00:03:49 +02:00
|
|
|
if (param->convert_str_value(stmt->thd))
|
|
|
|
DBUG_RETURN(1); /* out of memory */
|
2003-04-04 19:33:17 +02:00
|
|
|
}
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
}
|
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
static bool setup_conversion_functions(Prepared_statement *stmt,
|
2004-03-15 18:20:47 +01:00
|
|
|
uchar **data, uchar *data_end)
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
{
|
|
|
|
/* skip null bits */
|
|
|
|
uchar *read_pos= *data + (stmt->param_count+7) / 8;
|
2002-06-12 23:13:12 +02:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
DBUG_ENTER("setup_conversion_functions");
|
2003-12-20 00:16:10 +01:00
|
|
|
|
2002-11-22 19:04:42 +01:00
|
|
|
if (*read_pos++) //types supplied / first execute
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
{
|
2002-11-22 19:04:42 +01:00
|
|
|
/*
|
|
|
|
First execute or types altered by the client, setup the
|
|
|
|
conversion routines for all parameters (one time)
|
|
|
|
*/
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
Item_param **it= stmt->param_array;
|
|
|
|
Item_param **end= it + stmt->param_count;
|
2004-05-25 00:03:49 +02:00
|
|
|
THD *thd= stmt->thd;
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
for (; it < end; ++it)
|
|
|
|
{
|
2004-04-30 01:00:19 +02:00
|
|
|
ushort typecode;
|
|
|
|
const uint signed_bit= 1 << 15;
|
|
|
|
|
2004-03-15 18:20:47 +01:00
|
|
|
if (read_pos >= data_end)
|
|
|
|
DBUG_RETURN(1);
|
2004-04-30 01:00:19 +02:00
|
|
|
|
|
|
|
typecode= sint2korr(read_pos);
|
2002-12-07 08:39:11 +01:00
|
|
|
read_pos+= 2;
|
2004-04-30 01:00:19 +02:00
|
|
|
(**it).unsigned_flag= test(typecode & signed_bit);
|
2004-05-25 00:03:49 +02:00
|
|
|
setup_one_conversion_function(thd, *it, (uchar) (typecode & ~signed_bit));
|
2002-06-12 23:13:12 +02:00
|
|
|
}
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
}
|
|
|
|
*data= read_pos;
|
2002-06-12 23:13:12 +02:00
|
|
|
DBUG_RETURN(0);
|
|
|
|
}
|
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
#else
|
|
|
|
|
2004-05-24 19:08:22 +02:00
|
|
|
static bool emb_insert_params(Prepared_statement *stmt, String *expanded_query)
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
{
|
2004-05-25 00:03:49 +02:00
|
|
|
THD *thd= stmt->thd;
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
Item_param **it= stmt->param_array;
|
|
|
|
Item_param **end= it + stmt->param_count;
|
2003-12-20 00:16:10 +01:00
|
|
|
MYSQL_BIND *client_param= stmt->thd->client_params;
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
DBUG_ENTER("emb_insert_params");
|
2003-12-20 00:16:10 +01:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
for (; it < end; ++it, ++client_param)
|
|
|
|
{
|
|
|
|
Item_param *param= *it;
|
2004-05-25 00:03:49 +02:00
|
|
|
setup_one_conversion_function(thd, param, client_param->buffer_type);
|
|
|
|
if (param->state != Item_param::LONG_DATA_VALUE)
|
2003-12-20 00:16:10 +01:00
|
|
|
{
|
|
|
|
if (*client_param->is_null)
|
2004-05-04 17:08:19 +02:00
|
|
|
param->set_null();
|
2003-12-20 00:16:10 +01:00
|
|
|
else
|
|
|
|
{
|
2004-05-25 00:03:49 +02:00
|
|
|
uchar *buff= (uchar*) client_param->buffer;
|
2004-08-19 12:38:12 +02:00
|
|
|
param->unsigned_flag= client_param->is_unsigned;
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
param->set_param_func(param, &buff,
|
|
|
|
client_param->length ?
|
|
|
|
*client_param->length :
|
|
|
|
client_param->buffer_length);
|
2003-12-20 00:16:10 +01:00
|
|
|
}
|
|
|
|
}
|
2004-05-25 00:03:49 +02:00
|
|
|
if (param->convert_str_value(thd))
|
|
|
|
DBUG_RETURN(1); /* out of memory */
|
2003-12-20 00:16:10 +01:00
|
|
|
}
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
}
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
|
2004-05-24 19:08:22 +02:00
|
|
|
static bool emb_insert_params_withlog(Prepared_statement *stmt, String *query)
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
{
|
2003-12-20 00:16:10 +01:00
|
|
|
THD *thd= stmt->thd;
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
Item_param **it= stmt->param_array;
|
|
|
|
Item_param **end= it + stmt->param_count;
|
2003-12-20 00:16:10 +01:00
|
|
|
MYSQL_BIND *client_param= thd->client_params;
|
|
|
|
|
2004-05-24 19:08:22 +02:00
|
|
|
String str;
|
2003-12-20 00:16:10 +01:00
|
|
|
const String *res;
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
uint32 length= 0;
|
2003-12-20 00:16:10 +01:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
DBUG_ENTER("emb_insert_params_withlog");
|
2003-12-20 00:16:10 +01:00
|
|
|
|
2004-05-24 19:08:22 +02:00
|
|
|
if (query->copy(stmt->query, stmt->query_length, default_charset_info))
|
2003-12-20 00:16:10 +01:00
|
|
|
DBUG_RETURN(1);
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
for (; it < end; ++it, ++client_param)
|
|
|
|
{
|
|
|
|
Item_param *param= *it;
|
2004-05-25 00:03:49 +02:00
|
|
|
setup_one_conversion_function(thd, param, client_param->buffer_type);
|
|
|
|
if (param->state != Item_param::LONG_DATA_VALUE)
|
2003-12-20 00:16:10 +01:00
|
|
|
{
|
|
|
|
if (*client_param->is_null)
|
2004-05-04 17:08:19 +02:00
|
|
|
param->set_null();
|
2003-12-20 00:16:10 +01:00
|
|
|
else
|
|
|
|
{
|
2004-05-25 00:03:49 +02:00
|
|
|
uchar *buff= (uchar*)client_param->buffer;
|
2004-08-19 12:36:05 +02:00
|
|
|
param->unsigned_flag= client_param->is_unsigned;
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
param->set_param_func(param, &buff,
|
|
|
|
client_param->length ?
|
|
|
|
*client_param->length :
|
|
|
|
client_param->buffer_length);
|
2003-12-20 00:16:10 +01:00
|
|
|
}
|
|
|
|
}
|
2004-06-01 15:27:40 +02:00
|
|
|
res= param->query_val_str(&str);
|
|
|
|
if (param->convert_str_value(thd))
|
|
|
|
DBUG_RETURN(1); /* out of memory */
|
|
|
|
|
2004-05-24 19:08:22 +02:00
|
|
|
if (query->replace(param->pos_in_query+length, 1, *res))
|
2003-12-20 00:16:10 +01:00
|
|
|
DBUG_RETURN(1);
|
2004-06-07 10:09:10 +02:00
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
length+= res->length()-1;
|
|
|
|
}
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
}
|
|
|
|
|
2003-09-17 17:48:53 +02:00
|
|
|
#endif /*!EMBEDDED_LIBRARY*/
|
|
|
|
|
2004-04-10 00:14:32 +02:00
|
|
|
|
2004-06-07 10:09:10 +02:00
|
|
|
/*
|
2004-04-05 17:43:37 +02:00
|
|
|
Set prepared statement parameters from user variables.
|
|
|
|
SYNOPSIS
|
|
|
|
insert_params_from_vars()
|
|
|
|
stmt Statement
|
|
|
|
varnames List of variables. Caller must ensure that number of variables
|
|
|
|
in the list is equal to number of statement parameters
|
2004-05-24 19:08:22 +02:00
|
|
|
query Ignored
|
2004-04-05 17:43:37 +02:00
|
|
|
*/
|
|
|
|
|
2004-06-07 10:09:10 +02:00
|
|
|
static bool insert_params_from_vars(Prepared_statement *stmt,
|
|
|
|
List<LEX_STRING>& varnames,
|
2004-05-24 19:08:22 +02:00
|
|
|
String *query __attribute__((unused)))
|
2004-04-05 17:43:37 +02:00
|
|
|
{
|
|
|
|
Item_param **begin= stmt->param_array;
|
|
|
|
Item_param **end= begin + stmt->param_count;
|
|
|
|
user_var_entry *entry;
|
|
|
|
LEX_STRING *varname;
|
|
|
|
List_iterator<LEX_STRING> var_it(varnames);
|
2004-06-07 10:09:10 +02:00
|
|
|
DBUG_ENTER("insert_params_from_vars");
|
|
|
|
|
2004-04-05 17:43:37 +02:00
|
|
|
for (Item_param **it= begin; it < end; ++it)
|
|
|
|
{
|
|
|
|
Item_param *param= *it;
|
|
|
|
varname= var_it++;
|
2004-06-07 10:09:10 +02:00
|
|
|
entry= (user_var_entry*)hash_search(&stmt->thd->user_vars,
|
|
|
|
(byte*) varname->str,
|
|
|
|
varname->length);
|
|
|
|
if (param->set_from_user_var(stmt->thd, entry) ||
|
|
|
|
param->convert_str_value(stmt->thd))
|
|
|
|
DBUG_RETURN(1);
|
2004-04-05 17:43:37 +02:00
|
|
|
}
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
}
|
|
|
|
|
2004-05-24 19:08:22 +02:00
|
|
|
|
2004-06-07 10:09:10 +02:00
|
|
|
/*
|
2004-05-24 19:08:22 +02:00
|
|
|
Do the same as insert_params_from_vars but also construct query text for
|
|
|
|
binary log.
|
|
|
|
SYNOPSIS
|
|
|
|
insert_params_from_vars()
|
|
|
|
stmt Statement
|
|
|
|
varnames List of variables. Caller must ensure that number of variables
|
|
|
|
in the list is equal to number of statement parameters
|
|
|
|
query The query with parameter markers replaced with their values
|
|
|
|
*/
|
|
|
|
|
2004-04-05 17:43:37 +02:00
|
|
|
static bool insert_params_from_vars_with_log(Prepared_statement *stmt,
|
2004-06-07 10:09:10 +02:00
|
|
|
List<LEX_STRING>& varnames,
|
2004-05-24 19:08:22 +02:00
|
|
|
String *query)
|
2004-04-05 17:43:37 +02:00
|
|
|
{
|
|
|
|
Item_param **begin= stmt->param_array;
|
|
|
|
Item_param **end= begin + stmt->param_count;
|
|
|
|
user_var_entry *entry;
|
|
|
|
LEX_STRING *varname;
|
2004-06-07 10:09:10 +02:00
|
|
|
DBUG_ENTER("insert_params_from_vars");
|
2004-04-05 17:43:37 +02:00
|
|
|
|
|
|
|
List_iterator<LEX_STRING> var_it(varnames);
|
2004-05-24 19:08:22 +02:00
|
|
|
String str;
|
2004-04-05 17:43:37 +02:00
|
|
|
uint32 length= 0;
|
2004-05-24 19:08:22 +02:00
|
|
|
if (query->copy(stmt->query, stmt->query_length, default_charset_info))
|
2004-04-12 23:58:48 +02:00
|
|
|
DBUG_RETURN(1);
|
2004-04-05 17:43:37 +02:00
|
|
|
|
|
|
|
for (Item_param **it= begin; it < end; ++it)
|
|
|
|
{
|
|
|
|
Item_param *param= *it;
|
|
|
|
varname= var_it++;
|
2004-06-01 15:27:40 +02:00
|
|
|
if (get_var_with_binlog(stmt->thd, *varname, &entry))
|
|
|
|
DBUG_RETURN(1);
|
|
|
|
DBUG_ASSERT(entry);
|
2004-04-05 17:43:37 +02:00
|
|
|
|
2004-06-07 10:09:10 +02:00
|
|
|
if (param->set_from_user_var(stmt->thd, entry))
|
|
|
|
DBUG_RETURN(1);
|
|
|
|
/* Insert @'escaped-varname' instead of parameter in the query */
|
2004-06-01 15:27:40 +02:00
|
|
|
char *buf, *ptr;
|
|
|
|
str.length(0);
|
|
|
|
if (str.reserve(entry->name.length*2+3))
|
2004-04-05 17:43:37 +02:00
|
|
|
DBUG_RETURN(1);
|
2004-06-01 15:27:40 +02:00
|
|
|
|
|
|
|
buf= str.c_ptr_quick();
|
|
|
|
ptr= buf;
|
|
|
|
*ptr++= '@';
|
|
|
|
*ptr++= '\'';
|
2004-06-07 10:09:10 +02:00
|
|
|
ptr+=
|
|
|
|
escape_string_for_mysql(&my_charset_utf8_general_ci,
|
2004-06-01 15:27:40 +02:00
|
|
|
ptr, entry->name.str, entry->name.length);
|
|
|
|
*ptr++= '\'';
|
|
|
|
str.length(ptr - buf);
|
|
|
|
|
|
|
|
if (param->convert_str_value(stmt->thd))
|
|
|
|
DBUG_RETURN(1); /* out of memory */
|
2004-06-07 10:09:10 +02:00
|
|
|
|
2004-06-01 15:27:40 +02:00
|
|
|
if (query->replace(param->pos_in_query+length, 1, str))
|
|
|
|
DBUG_RETURN(1);
|
|
|
|
length+= str.length()-1;
|
2004-04-05 17:43:37 +02:00
|
|
|
}
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
}
|
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
/*
|
2004-04-10 00:14:32 +02:00
|
|
|
Validate INSERT statement:
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
SYNOPSIS
|
2004-04-10 00:14:32 +02:00
|
|
|
mysql_test_insert()
|
|
|
|
stmt prepared statemen handler
|
2004-07-16 00:15:55 +02:00
|
|
|
tables global/local table list
|
2004-04-10 00:14:32 +02:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
RETURN VALUE
|
|
|
|
0 ok
|
|
|
|
1 error, sent to the client
|
|
|
|
-1 error, not sent to client
|
2002-06-12 23:13:12 +02:00
|
|
|
*/
|
2004-09-09 06:26:28 +02:00
|
|
|
|
2004-04-10 00:14:32 +02:00
|
|
|
static int mysql_test_insert(Prepared_statement *stmt,
|
|
|
|
TABLE_LIST *table_list,
|
|
|
|
List<Item> &fields,
|
|
|
|
List<List_item> &values_list,
|
|
|
|
List<Item> &update_fields,
|
|
|
|
List<Item> &update_values,
|
|
|
|
enum_duplicates duplic)
|
2002-06-12 23:13:12 +02:00
|
|
|
{
|
2002-10-02 12:33:08 +02:00
|
|
|
THD *thd= stmt->thd;
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
LEX *lex= stmt->lex;
|
2002-06-12 23:13:12 +02:00
|
|
|
List_iterator_fast<List_item> its(values_list);
|
|
|
|
List_item *values;
|
2004-09-09 06:26:28 +02:00
|
|
|
int res;
|
2004-05-25 00:03:49 +02:00
|
|
|
DBUG_ENTER("mysql_test_insert");
|
2002-06-12 23:13:12 +02:00
|
|
|
|
2004-10-20 14:04:43 +02:00
|
|
|
if ((res= insert_precheck(thd, table_list)))
|
2004-04-10 00:14:32 +02:00
|
|
|
DBUG_RETURN(res);
|
2004-02-20 14:37:45 +01:00
|
|
|
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
/*
|
2004-02-20 14:37:45 +01:00
|
|
|
open temporary memory pool for temporary data allocated by derived
|
|
|
|
tables & preparation procedure
|
|
|
|
*/
|
2004-08-31 09:06:38 +02:00
|
|
|
if ((res= open_and_lock_tables(thd, table_list)))
|
2004-02-12 17:50:00 +01:00
|
|
|
{
|
2004-08-31 09:06:38 +02:00
|
|
|
DBUG_RETURN(res);
|
2004-02-12 17:50:00 +01:00
|
|
|
}
|
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
if ((values= its++))
|
|
|
|
{
|
|
|
|
uint value_count;
|
2002-10-02 12:33:08 +02:00
|
|
|
ulong counter= 0;
|
2002-06-12 23:13:12 +02:00
|
|
|
|
2004-07-16 00:15:55 +02:00
|
|
|
if ((res= mysql_prepare_insert(thd, table_list, table_list->table,
|
|
|
|
fields, values, update_fields,
|
|
|
|
update_values, duplic)))
|
2004-04-10 00:14:32 +02:00
|
|
|
goto error;
|
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
value_count= values->elements;
|
|
|
|
its.rewind();
|
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
while ((values= its++))
|
2002-06-12 23:13:12 +02:00
|
|
|
{
|
|
|
|
counter++;
|
|
|
|
if (values->elements != value_count)
|
|
|
|
{
|
|
|
|
my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
|
|
|
|
ER(ER_WRONG_VALUE_COUNT_ON_ROW),
|
2002-10-02 12:33:08 +02:00
|
|
|
MYF(0), counter);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
goto error;
|
2002-06-12 23:13:12 +02:00
|
|
|
}
|
2004-07-16 00:15:55 +02:00
|
|
|
if (setup_fields(thd, 0, table_list, *values, 0, 0, 0))
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
goto error;
|
2002-06-12 23:13:12 +02:00
|
|
|
}
|
|
|
|
}
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
|
2004-04-10 00:14:32 +02:00
|
|
|
res= 0;
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
error:
|
|
|
|
lex->unit.cleanup();
|
2004-04-10 00:14:32 +02:00
|
|
|
DBUG_RETURN(res);
|
2002-06-12 23:13:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2004-04-10 00:14:32 +02:00
|
|
|
Validate UPDATE statement
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
SYNOPSIS
|
2004-05-25 00:03:49 +02:00
|
|
|
mysql_test_update()
|
2004-04-10 00:14:32 +02:00
|
|
|
stmt prepared statemen handler
|
|
|
|
tables list of tables queries
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
RETURN VALUE
|
|
|
|
0 success
|
|
|
|
1 error, sent to client
|
|
|
|
-1 error, not sent to client
|
2002-06-12 23:13:12 +02:00
|
|
|
*/
|
2004-04-10 00:14:32 +02:00
|
|
|
static int mysql_test_update(Prepared_statement *stmt,
|
|
|
|
TABLE_LIST *table_list)
|
2002-06-12 23:13:12 +02:00
|
|
|
{
|
2004-04-10 00:14:32 +02:00
|
|
|
int res;
|
2002-10-02 12:33:08 +02:00
|
|
|
THD *thd= stmt->thd;
|
2004-04-10 00:14:32 +02:00
|
|
|
SELECT_LEX *select= &stmt->lex->select_lex;
|
|
|
|
DBUG_ENTER("mysql_test_update");
|
|
|
|
|
|
|
|
if ((res= update_precheck(thd, table_list)))
|
|
|
|
DBUG_RETURN(res);
|
2004-02-20 14:37:45 +01:00
|
|
|
|
2004-09-09 06:26:28 +02:00
|
|
|
if (!(res=open_and_lock_tables(thd, table_list)))
|
2004-02-12 17:50:00 +01:00
|
|
|
{
|
2004-04-10 00:14:32 +02:00
|
|
|
if (!(res= mysql_prepare_update(thd, table_list,
|
|
|
|
&select->where,
|
|
|
|
select->order_list.elements,
|
|
|
|
(ORDER *) select->order_list.first)))
|
|
|
|
{
|
2004-08-16 22:15:31 +02:00
|
|
|
thd->lex->select_lex.no_wrap_view_item= 1;
|
|
|
|
if (setup_fields(thd, 0, table_list, select->item_list, 1, 0, 0))
|
|
|
|
{
|
|
|
|
res= -1;
|
|
|
|
thd->lex->select_lex.no_wrap_view_item= 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
thd->lex->select_lex.no_wrap_view_item= 0;
|
|
|
|
if (setup_fields(thd, 0, table_list,
|
|
|
|
stmt->lex->value_list, 0, 0, 0))
|
|
|
|
res= -1;
|
|
|
|
}
|
2004-04-10 00:14:32 +02:00
|
|
|
}
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
stmt->lex->unit.cleanup();
|
2004-02-12 17:50:00 +01:00
|
|
|
}
|
2004-04-10 00:14:32 +02:00
|
|
|
/* TODO: here we should send types of placeholders to the client. */
|
|
|
|
DBUG_RETURN(res);
|
2002-06-12 23:13:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2004-04-10 00:14:32 +02:00
|
|
|
Validate DELETE statement
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
SYNOPSIS
|
2004-04-10 00:14:32 +02:00
|
|
|
mysql_test_delete()
|
|
|
|
stmt prepared statemen handler
|
|
|
|
tables list of tables queries
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
RETURN VALUE
|
|
|
|
0 success
|
|
|
|
1 error, sent to client
|
|
|
|
-1 error, not sent to client
|
2002-06-12 23:13:12 +02:00
|
|
|
*/
|
2004-04-10 00:14:32 +02:00
|
|
|
static int mysql_test_delete(Prepared_statement *stmt,
|
|
|
|
TABLE_LIST *table_list)
|
2002-06-12 23:13:12 +02:00
|
|
|
{
|
2004-04-10 00:14:32 +02:00
|
|
|
int res;
|
2002-10-02 12:33:08 +02:00
|
|
|
THD *thd= stmt->thd;
|
2004-04-10 00:14:32 +02:00
|
|
|
LEX *lex= stmt->lex;
|
|
|
|
DBUG_ENTER("mysql_test_delete");
|
2002-06-12 23:13:12 +02:00
|
|
|
|
2004-04-10 00:14:32 +02:00
|
|
|
if ((res= delete_precheck(thd, table_list)))
|
|
|
|
DBUG_RETURN(res);
|
2002-06-12 23:13:12 +02:00
|
|
|
|
2004-09-09 06:26:28 +02:00
|
|
|
if (!(res=open_and_lock_tables(thd, table_list)))
|
2004-04-10 00:14:32 +02:00
|
|
|
{
|
|
|
|
res= mysql_prepare_delete(thd, table_list, &lex->select_lex.where);
|
|
|
|
lex->unit.cleanup();
|
|
|
|
}
|
|
|
|
/* TODO: here we should send types of placeholders to the client. */
|
|
|
|
DBUG_RETURN(res);
|
2002-06-12 23:13:12 +02:00
|
|
|
}
|
|
|
|
|
2004-04-10 00:14:32 +02:00
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
/*
|
2004-04-10 00:14:32 +02:00
|
|
|
Validate SELECT statement.
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
In case of success, if this query is not EXPLAIN, send column list info
|
|
|
|
back to client.
|
2004-04-10 00:14:32 +02:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
SYNOPSIS
|
2004-04-10 00:14:32 +02:00
|
|
|
mysql_test_select()
|
|
|
|
stmt prepared statemen handler
|
|
|
|
tables list of tables queries
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
RETURN VALUE
|
|
|
|
0 success
|
|
|
|
1 error, sent to client
|
|
|
|
-1 error, not sent to client
|
2002-06-12 23:13:12 +02:00
|
|
|
*/
|
2003-12-20 00:16:10 +01:00
|
|
|
|
2004-04-10 00:14:32 +02:00
|
|
|
static int mysql_test_select(Prepared_statement *stmt,
|
2004-04-13 00:18:09 +02:00
|
|
|
TABLE_LIST *tables, bool text_protocol)
|
2002-06-12 23:13:12 +02:00
|
|
|
{
|
2002-10-02 12:33:08 +02:00
|
|
|
THD *thd= stmt->thd;
|
2003-12-20 00:16:10 +01:00
|
|
|
LEX *lex= stmt->lex;
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
SELECT_LEX_UNIT *unit= &lex->unit;
|
2004-09-09 13:55:28 +02:00
|
|
|
int result;
|
2004-04-10 00:14:32 +02:00
|
|
|
DBUG_ENTER("mysql_test_select");
|
2002-06-12 23:13:12 +02:00
|
|
|
|
2003-09-26 12:33:13 +02:00
|
|
|
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
2003-02-25 02:22:02 +01:00
|
|
|
ulong privilege= lex->exchange ? SELECT_ACL | FILE_ACL : SELECT_ACL;
|
|
|
|
if (tables)
|
|
|
|
{
|
2003-09-26 12:33:13 +02:00
|
|
|
if (check_table_access(thd, privilege, tables,0))
|
2003-02-25 02:22:02 +01:00
|
|
|
DBUG_RETURN(1);
|
|
|
|
}
|
2004-04-06 12:31:25 +02:00
|
|
|
else if (check_access(thd, privilege, any_db,0,0,0))
|
2003-02-25 02:22:02 +01:00
|
|
|
DBUG_RETURN(1);
|
2003-09-26 12:33:13 +02:00
|
|
|
#endif
|
2004-02-20 14:37:45 +01:00
|
|
|
|
2004-10-21 16:33:53 +02:00
|
|
|
if (!lex->result && !(lex->result= new (&stmt->mem_root) select_send))
|
|
|
|
{
|
|
|
|
send_error(thd);
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
2004-09-09 06:26:28 +02:00
|
|
|
if ((result= open_and_lock_tables(thd, tables)))
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
{
|
2004-09-09 13:55:28 +02:00
|
|
|
result= 1; // Error sent
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
send_error(thd);
|
2004-02-20 14:37:45 +01:00
|
|
|
goto err;
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
}
|
2004-09-09 06:26:28 +02:00
|
|
|
result= 1;
|
2002-06-12 23:13:12 +02:00
|
|
|
|
2004-06-25 10:37:43 +02:00
|
|
|
thd->used_tables= 0; // Updated by setup_fields
|
|
|
|
|
|
|
|
// JOIN::prepare calls
|
|
|
|
if (unit->prepare(thd, 0, 0))
|
|
|
|
{
|
|
|
|
send_error(thd);
|
|
|
|
goto err_prep;
|
|
|
|
}
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
if (!text_protocol)
|
2003-03-04 23:22:30 +01:00
|
|
|
{
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
if (lex->describe)
|
|
|
|
{
|
|
|
|
if (send_prep_stmt(stmt, 0))
|
|
|
|
goto err_prep;
|
|
|
|
}
|
|
|
|
else
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
{
|
2004-10-26 18:30:01 +02:00
|
|
|
/* Make copy of item list, as change_columns may change it */
|
|
|
|
List<Item> fields(lex->select_lex.item_list);
|
|
|
|
|
|
|
|
/* Change columns if a procedure like analyse() */
|
|
|
|
if (unit->last_procedure &&
|
|
|
|
unit->last_procedure->change_columns(fields))
|
|
|
|
goto err_prep;
|
|
|
|
|
2004-10-21 16:33:53 +02:00
|
|
|
/*
|
|
|
|
We can use lex->result as it should've been
|
|
|
|
prepared in unit->prepare call above.
|
|
|
|
*/
|
|
|
|
if (send_prep_stmt(stmt, lex->result->field_count(fields)) ||
|
2004-11-03 11:39:38 +01:00
|
|
|
lex->result->send_fields(fields, Protocol::SEND_EOF)
|
2003-09-18 15:58:02 +02:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
2004-04-05 17:43:37 +02:00
|
|
|
|| net_flush(&thd->net)
|
2003-09-18 15:58:02 +02:00
|
|
|
#endif
|
2004-04-05 17:43:37 +02:00
|
|
|
)
|
|
|
|
goto err_prep;
|
|
|
|
}
|
2003-03-04 23:22:30 +01:00
|
|
|
}
|
2004-08-31 13:35:04 +02:00
|
|
|
result= 0; // ok
|
2004-02-12 17:50:00 +01:00
|
|
|
|
|
|
|
err_prep:
|
|
|
|
unit->cleanup();
|
|
|
|
err:
|
2004-08-31 13:35:04 +02:00
|
|
|
DBUG_RETURN(result);
|
2002-06-12 23:13:12 +02:00
|
|
|
}
|
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
/*
|
|
|
|
Validate and prepare for execution DO statement expressions
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
mysql_test_do_fields()
|
|
|
|
stmt prepared statemen handler
|
|
|
|
tables list of tables queries
|
|
|
|
values list of expressions
|
|
|
|
|
|
|
|
RETURN VALUE
|
|
|
|
0 success
|
|
|
|
1 error, sent to client
|
|
|
|
-1 error, not sent to client
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int mysql_test_do_fields(Prepared_statement *stmt,
|
|
|
|
TABLE_LIST *tables,
|
|
|
|
List<Item> *values)
|
|
|
|
{
|
|
|
|
DBUG_ENTER("mysql_test_do_fields");
|
|
|
|
THD *thd= stmt->thd;
|
|
|
|
int res= 0;
|
|
|
|
if (tables && (res= check_table_access(thd, SELECT_ACL, tables, 0)))
|
|
|
|
DBUG_RETURN(res);
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
if (tables && (res= open_and_lock_tables(thd, tables)))
|
|
|
|
{
|
|
|
|
DBUG_RETURN(res);
|
|
|
|
}
|
|
|
|
res= setup_fields(thd, 0, 0, *values, 0, 0, 0);
|
|
|
|
stmt->lex->unit.cleanup();
|
|
|
|
if (res)
|
|
|
|
DBUG_RETURN(-1);
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Validate and prepare for execution SET statement expressions
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
mysql_test_set_fields()
|
|
|
|
stmt prepared statemen handler
|
|
|
|
tables list of tables queries
|
|
|
|
values list of expressions
|
|
|
|
|
|
|
|
RETURN VALUE
|
|
|
|
0 success
|
|
|
|
1 error, sent to client
|
|
|
|
-1 error, not sent to client
|
|
|
|
*/
|
|
|
|
static int mysql_test_set_fields(Prepared_statement *stmt,
|
|
|
|
TABLE_LIST *tables,
|
|
|
|
List<set_var_base> *var_list)
|
|
|
|
{
|
|
|
|
DBUG_ENTER("mysql_test_set_fields");
|
|
|
|
List_iterator_fast<set_var_base> it(*var_list);
|
|
|
|
THD *thd= stmt->thd;
|
|
|
|
set_var_base *var;
|
|
|
|
int res= 0;
|
|
|
|
|
|
|
|
if (tables && (res= check_table_access(thd, SELECT_ACL, tables, 0)))
|
|
|
|
DBUG_RETURN(res);
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
if (tables && (res= open_and_lock_tables(thd, tables)))
|
|
|
|
goto error;
|
|
|
|
while ((var= it++))
|
|
|
|
{
|
|
|
|
if (var->light_check(thd))
|
|
|
|
{
|
|
|
|
stmt->lex->unit.cleanup();
|
|
|
|
res= -1;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
error:
|
2004-04-10 00:14:32 +02:00
|
|
|
stmt->lex->unit.cleanup();
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
DBUG_RETURN(res);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Check internal SELECT of the prepared command
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
select_like_statement_test()
|
2004-07-16 00:15:55 +02:00
|
|
|
stmt - prepared table handler
|
|
|
|
tables - global list of tables
|
|
|
|
specific_prepare - function of command specific prepare
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
|
2004-04-10 00:14:32 +02:00
|
|
|
RETURN VALUE
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
0 success
|
|
|
|
1 error, sent to client
|
2004-05-05 15:54:11 +02:00
|
|
|
-1 error, not sent to client
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
*/
|
|
|
|
static int select_like_statement_test(Prepared_statement *stmt,
|
2004-07-16 00:15:55 +02:00
|
|
|
TABLE_LIST *tables,
|
|
|
|
int (*specific_prepare)(THD *thd))
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
{
|
|
|
|
DBUG_ENTER("select_like_statement_test");
|
|
|
|
THD *thd= stmt->thd;
|
|
|
|
LEX *lex= stmt->lex;
|
|
|
|
int res= 0;
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
if (tables && (res= open_and_lock_tables(thd, tables)))
|
|
|
|
goto end;
|
|
|
|
|
2004-07-16 00:15:55 +02:00
|
|
|
if (specific_prepare && (res= (*specific_prepare)(thd)))
|
|
|
|
goto end;
|
|
|
|
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
thd->used_tables= 0; // Updated by setup_fields
|
|
|
|
|
2004-04-10 00:14:32 +02:00
|
|
|
// JOIN::prepare calls
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
if (lex->unit.prepare(thd, 0, 0))
|
|
|
|
{
|
|
|
|
res= thd->net.report_error ? -1 : 1;
|
|
|
|
}
|
|
|
|
end:
|
|
|
|
lex->unit.cleanup();
|
|
|
|
DBUG_RETURN(res);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2004-05-25 00:03:49 +02:00
|
|
|
Validate and prepare for execution CREATE TABLE statement
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
mysql_test_create_table()
|
|
|
|
stmt prepared statemen handler
|
|
|
|
tables list of tables queries
|
|
|
|
|
|
|
|
RETURN VALUE
|
|
|
|
0 success
|
|
|
|
1 error, sent to client
|
|
|
|
-1 error, not sent to client
|
|
|
|
*/
|
2004-09-09 06:26:28 +02:00
|
|
|
|
2004-07-16 00:15:55 +02:00
|
|
|
static int mysql_test_create_table(Prepared_statement *stmt)
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
{
|
|
|
|
DBUG_ENTER("mysql_test_create_table");
|
|
|
|
THD *thd= stmt->thd;
|
|
|
|
LEX *lex= stmt->lex;
|
2004-06-13 21:39:09 +02:00
|
|
|
SELECT_LEX *select_lex= &lex->select_lex;
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
int res= 0;
|
|
|
|
/* Skip first table, which is the table we are creating */
|
2004-07-16 00:15:55 +02:00
|
|
|
bool link_to_local;
|
|
|
|
TABLE_LIST *create_table= lex->unlink_first_table(&link_to_local);
|
|
|
|
TABLE_LIST *tables= lex->query_tables;
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
|
2004-04-10 00:14:32 +02:00
|
|
|
if (!(res= create_table_precheck(thd, tables, create_table)) &&
|
2004-06-13 21:39:09 +02:00
|
|
|
select_lex->item_list.elements)
|
|
|
|
{
|
|
|
|
select_lex->resolve_mode= SELECT_LEX::SELECT_MODE;
|
2004-07-16 00:15:55 +02:00
|
|
|
res= select_like_statement_test(stmt, tables, 0);
|
2004-06-13 21:39:09 +02:00
|
|
|
select_lex->resolve_mode= SELECT_LEX::NOMATTER_MODE;
|
|
|
|
}
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
|
2004-04-10 00:14:32 +02:00
|
|
|
/* put tables back for PS rexecuting */
|
2004-07-16 00:15:55 +02:00
|
|
|
lex->link_first_table_back(create_table, link_to_local);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
DBUG_RETURN(res);
|
|
|
|
}
|
|
|
|
|
2004-04-10 00:14:32 +02:00
|
|
|
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
/*
|
2004-05-25 00:03:49 +02:00
|
|
|
Validate and prepare for execution multi update statement
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
mysql_test_multiupdate()
|
|
|
|
stmt prepared statemen handler
|
|
|
|
tables list of tables queries
|
|
|
|
|
|
|
|
RETURN VALUE
|
|
|
|
0 success
|
|
|
|
1 error, sent to client
|
|
|
|
-1 error, not sent to client
|
|
|
|
*/
|
|
|
|
static int mysql_test_multiupdate(Prepared_statement *stmt,
|
|
|
|
TABLE_LIST *tables)
|
|
|
|
{
|
|
|
|
int res;
|
|
|
|
if ((res= multi_update_precheck(stmt->thd, tables)))
|
|
|
|
return res;
|
2004-07-16 00:15:55 +02:00
|
|
|
return select_like_statement_test(stmt, tables, &mysql_multi_update_prepare);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2004-05-25 00:03:49 +02:00
|
|
|
Validate and prepare for execution multi delete statement
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
mysql_test_multidelete()
|
|
|
|
stmt prepared statemen handler
|
|
|
|
tables list of tables queries
|
|
|
|
|
|
|
|
RETURN VALUE
|
|
|
|
0 success
|
|
|
|
1 error, sent to client
|
|
|
|
-1 error, not sent to client
|
|
|
|
*/
|
|
|
|
static int mysql_test_multidelete(Prepared_statement *stmt,
|
|
|
|
TABLE_LIST *tables)
|
|
|
|
{
|
|
|
|
int res;
|
|
|
|
stmt->thd->lex->current_select= &stmt->thd->lex->select_lex;
|
|
|
|
if (add_item_to_list(stmt->thd, new Item_null()))
|
|
|
|
return -1;
|
|
|
|
|
2004-04-10 00:14:32 +02:00
|
|
|
uint fake_counter;
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
if ((res= multi_delete_precheck(stmt->thd, tables, &fake_counter)))
|
|
|
|
return res;
|
2004-07-16 00:15:55 +02:00
|
|
|
return select_like_statement_test(stmt, tables, &mysql_multi_delete_prepare);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Validate and prepare for execution INSERT ... SELECT statement
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
mysql_test_insert_select()
|
|
|
|
stmt prepared statemen handler
|
|
|
|
tables list of tables queries
|
|
|
|
|
|
|
|
RETURN VALUE
|
|
|
|
0 success
|
|
|
|
1 error, sent to client
|
|
|
|
-1 error, not sent to client
|
|
|
|
*/
|
|
|
|
static int mysql_test_insert_select(Prepared_statement *stmt,
|
|
|
|
TABLE_LIST *tables)
|
|
|
|
{
|
|
|
|
int res;
|
|
|
|
LEX *lex= stmt->lex;
|
|
|
|
if ((res= insert_select_precheck(stmt->thd, tables)))
|
|
|
|
return res;
|
|
|
|
TABLE_LIST *first_local_table=
|
|
|
|
(TABLE_LIST *)lex->select_lex.table_list.first;
|
2004-07-16 00:15:55 +02:00
|
|
|
DBUG_ASSERT(first_local_table != 0);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
/* Skip first table, which is the table we are inserting in */
|
2004-07-16 00:15:55 +02:00
|
|
|
lex->select_lex.table_list.first= (byte*) first_local_table->next_local;
|
2004-06-13 21:39:09 +02:00
|
|
|
/*
|
|
|
|
insert/replace from SELECT give its SELECT_LEX for SELECT,
|
|
|
|
and item_list belong to SELECT
|
|
|
|
*/
|
|
|
|
lex->select_lex.resolve_mode= SELECT_LEX::SELECT_MODE;
|
2004-07-16 00:15:55 +02:00
|
|
|
res= select_like_statement_test(stmt, tables, &mysql_insert_select_prepare);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
/* revert changes*/
|
2004-05-05 15:54:11 +02:00
|
|
|
lex->select_lex.table_list.first= (byte*) first_local_table;
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
/*
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
Send the prepare query results back to client
|
|
|
|
SYNOPSIS
|
|
|
|
send_prepare_results()
|
|
|
|
stmt prepared statement
|
|
|
|
RETURN VALUE
|
|
|
|
0 success
|
|
|
|
1 error, sent to client
|
2002-06-12 23:13:12 +02:00
|
|
|
*/
|
2004-04-05 17:43:37 +02:00
|
|
|
static int send_prepare_results(Prepared_statement *stmt, bool text_protocol)
|
2002-06-12 23:13:12 +02:00
|
|
|
{
|
2002-10-02 12:33:08 +02:00
|
|
|
THD *thd= stmt->thd;
|
2003-12-20 00:16:10 +01:00
|
|
|
LEX *lex= stmt->lex;
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
SELECT_LEX *select_lex= &lex->select_lex;
|
2004-07-16 00:15:55 +02:00
|
|
|
TABLE_LIST *tables;
|
2003-12-20 00:16:10 +01:00
|
|
|
enum enum_sql_command sql_command= lex->sql_command;
|
2004-04-10 00:14:32 +02:00
|
|
|
int res= 0;
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_ENTER("send_prepare_results");
|
2004-04-10 00:14:32 +02:00
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_PRINT("enter",("command: %d, param_count: %ld",
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
sql_command, stmt->param_count));
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
|
2004-07-16 00:15:55 +02:00
|
|
|
lex->first_lists_tables_same();
|
|
|
|
tables= lex->query_tables;
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
switch (sql_command) {
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
case SQLCOM_REPLACE:
|
2002-06-12 23:13:12 +02:00
|
|
|
case SQLCOM_INSERT:
|
2004-04-10 00:14:32 +02:00
|
|
|
res= mysql_test_insert(stmt, tables, lex->field_list,
|
|
|
|
lex->many_values,
|
|
|
|
select_lex->item_list, lex->value_list,
|
2004-10-20 14:04:43 +02:00
|
|
|
lex->duplicates);
|
2002-06-12 23:13:12 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SQLCOM_UPDATE:
|
2004-04-10 00:14:32 +02:00
|
|
|
res= mysql_test_update(stmt, tables);
|
|
|
|
break;
|
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
case SQLCOM_DELETE:
|
2004-04-10 00:14:32 +02:00
|
|
|
res= mysql_test_delete(stmt, tables);
|
2002-06-12 23:13:12 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SQLCOM_SELECT:
|
2004-04-13 00:18:09 +02:00
|
|
|
if ((res= mysql_test_select(stmt, tables, text_protocol)))
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
goto error;
|
|
|
|
/* Statement and field info has already been sent */
|
|
|
|
DBUG_RETURN(0);
|
2002-06-12 23:13:12 +02:00
|
|
|
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
case SQLCOM_CREATE_TABLE:
|
2004-07-16 00:15:55 +02:00
|
|
|
res= mysql_test_create_table(stmt);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SQLCOM_DO:
|
2004-04-10 00:14:32 +02:00
|
|
|
res= mysql_test_do_fields(stmt, tables, lex->insert_list);
|
|
|
|
break;
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
|
|
|
|
case SQLCOM_SET_OPTION:
|
2004-04-10 00:14:32 +02:00
|
|
|
res= mysql_test_set_fields(stmt, tables, &lex->var_list);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SQLCOM_DELETE_MULTI:
|
2004-04-10 00:14:32 +02:00
|
|
|
res= mysql_test_multidelete(stmt, tables);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SQLCOM_UPDATE_MULTI:
|
2004-04-10 00:14:32 +02:00
|
|
|
res= mysql_test_multiupdate(stmt, tables);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SQLCOM_INSERT_SELECT:
|
2004-04-10 00:14:32 +02:00
|
|
|
res= mysql_test_insert_select(stmt, tables);
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SQLCOM_SHOW_DATABASES:
|
|
|
|
case SQLCOM_SHOW_PROCESSLIST:
|
|
|
|
case SQLCOM_SHOW_STORAGE_ENGINES:
|
|
|
|
case SQLCOM_SHOW_PRIVILEGES:
|
|
|
|
case SQLCOM_SHOW_COLUMN_TYPES:
|
|
|
|
case SQLCOM_SHOW_STATUS:
|
|
|
|
case SQLCOM_SHOW_VARIABLES:
|
|
|
|
case SQLCOM_SHOW_LOGS:
|
|
|
|
case SQLCOM_SHOW_TABLES:
|
|
|
|
case SQLCOM_SHOW_OPEN_TABLES:
|
|
|
|
case SQLCOM_SHOW_CHARSETS:
|
|
|
|
case SQLCOM_SHOW_COLLATIONS:
|
|
|
|
case SQLCOM_SHOW_FIELDS:
|
|
|
|
case SQLCOM_SHOW_KEYS:
|
|
|
|
case SQLCOM_SHOW_CREATE_DB:
|
|
|
|
case SQLCOM_SHOW_GRANTS:
|
|
|
|
case SQLCOM_DROP_TABLE:
|
|
|
|
case SQLCOM_RENAME_TABLE:
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
case SQLCOM_ALTER_TABLE:
|
|
|
|
case SQLCOM_COMMIT:
|
|
|
|
case SQLCOM_CREATE_INDEX:
|
|
|
|
case SQLCOM_DROP_INDEX:
|
|
|
|
case SQLCOM_ROLLBACK:
|
|
|
|
case SQLCOM_TRUNCATE:
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
break;
|
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
default:
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
/*
|
|
|
|
All other is not supported yet
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
*/
|
new error for unsupported command in PS
fixed IN subselect with basic constant left expression
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
unchecked commands now is rejected by PS protocol to avoid serever crash
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
include/mysqld_error.h:
new error for unsupported command in PS
mysql-test/r/multi_update.result:
test sutes (BUG#3408, BUG#3411)
mysql-test/t/multi_update.test:
test sutes (BUG#3408, BUG#3411)
sql/item_cmpfunc.cc:
fixed IN subselect with basic constant left expression
sql/mysql_priv.h:
some function frop sql_parse.h become public
sql/set_var.cc:
check for SET command via PS
sql/set_var.h:
check for SET command via PS
sql/share/czech/errmsg.txt:
new error for unsupported command in PS
sql/share/danish/errmsg.txt:
new error for unsupported command in PS
sql/share/dutch/errmsg.txt:
new error for unsupported command in PS
sql/share/english/errmsg.txt:
new error for unsupported command in PS
sql/share/estonian/errmsg.txt:
new error for unsupported command in PS
sql/share/french/errmsg.txt:
new error for unsupported command in PS
sql/share/german/errmsg.txt:
new error for unsupported command in PS
sql/share/greek/errmsg.txt:
new error for unsupported command in PS
sql/share/hungarian/errmsg.txt:
new error for unsupported command in PS
sql/share/italian/errmsg.txt:
new error for unsupported command in PS
sql/share/japanese/errmsg.txt:
new error for unsupported command in PS
sql/share/korean/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian-ny/errmsg.txt:
new error for unsupported command in PS
sql/share/norwegian/errmsg.txt:
new error for unsupported command in PS
sql/share/polish/errmsg.txt:
new error for unsupported command in PS
sql/share/portuguese/errmsg.txt:
new error for unsupported command in PS
sql/share/romanian/errmsg.txt:
new error for unsupported command in PS
sql/share/russian/errmsg.txt:
new error for unsupported command in PS
sql/share/serbian/errmsg.txt:
new error for unsupported command in PS
sql/share/slovak/errmsg.txt:
new error for unsupported command in PS
sql/share/spanish/errmsg.txt:
new error for unsupported command in PS
sql/share/swedish/errmsg.txt:
new error for unsupported command in PS
sql/share/ukrainian/errmsg.txt:
new error for unsupported command in PS
sql/sql_lex.cc:
first table unlincking procedures for CREATE command
sql/sql_lex.h:
first table unlincking procedures for CREATE command
sql/sql_parse.cc:
used function to exclude first table from list
SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406)
fixed multiupdate privelege check (BUG#3408)
fixed multiupdate tables check (BUG#3411)
sql/sql_prepare.cc:
fixed a lot of commands to be compatible with PS
unchecked commands now is rejected to avoid serever crash
sql/sql_select.cc:
allow empty result for PS preparing
sql/sql_union.cc:
fixed cleunup procedure to be compatible sith DO/SET (BUG#3393)
sql/sql_update.cc:
fixed update to use correct tables lists (BUG#3408)
sql/table.h:
flag to support multi update tables check (BUG#3408)
tests/client_test.c:
removed unsupported tables
fixed show table test
added new tests
2004-04-07 23:16:17 +02:00
|
|
|
res= -1;
|
|
|
|
my_error(ER_UNSUPPORTED_PS, MYF(0));
|
|
|
|
goto error;
|
2002-06-12 23:13:12 +02:00
|
|
|
}
|
2004-04-10 00:14:32 +02:00
|
|
|
if (res == 0)
|
2004-05-21 02:27:50 +02:00
|
|
|
DBUG_RETURN(text_protocol? 0 : send_prep_stmt(stmt, 0));
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
error:
|
|
|
|
if (res < 0)
|
2004-04-07 19:07:44 +02:00
|
|
|
send_error(thd,thd->killed_errno());
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_RETURN(1);
|
2002-06-12 23:13:12 +02:00
|
|
|
}
|
|
|
|
|
2002-11-22 19:04:42 +01:00
|
|
|
/*
|
2004-05-25 00:03:49 +02:00
|
|
|
Initialize array of parameters in statement from LEX.
|
|
|
|
(We need to have quick access to items by number in mysql_stmt_get_longdata).
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
This is to avoid using malloc/realloc in the parser.
|
2002-11-22 19:04:42 +01:00
|
|
|
*/
|
2003-01-03 12:52:53 +01:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
static bool init_param_array(Prepared_statement *stmt)
|
2002-11-22 19:04:42 +01:00
|
|
|
{
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
LEX *lex= stmt->lex;
|
2004-09-08 21:07:11 +02:00
|
|
|
THD *thd= stmt->thd;
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
if ((stmt->param_count= lex->param_list.elements))
|
|
|
|
{
|
2004-09-08 21:07:11 +02:00
|
|
|
if (stmt->param_count > (uint) UINT_MAX16)
|
|
|
|
{
|
|
|
|
/* Error code to be defined in 5.0 */
|
|
|
|
send_error(thd, ER_UNKNOWN_ERROR,
|
|
|
|
"Prepared statement contains too many placeholders.");
|
|
|
|
return 1;
|
|
|
|
}
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
Item_param **to;
|
|
|
|
List_iterator<Item_param> param_iterator(lex->param_list);
|
|
|
|
/* Use thd->mem_root as it points at statement mem_root */
|
|
|
|
stmt->param_array= (Item_param **)
|
|
|
|
alloc_root(&stmt->thd->mem_root,
|
|
|
|
sizeof(Item_param*) * stmt->param_count);
|
|
|
|
if (!stmt->param_array)
|
|
|
|
{
|
2004-09-08 21:07:11 +02:00
|
|
|
send_error(thd, ER_OUT_OF_RESOURCES);
|
2003-01-28 18:24:27 +01:00
|
|
|
return 1;
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
}
|
|
|
|
for (to= stmt->param_array;
|
|
|
|
to < stmt->param_array + stmt->param_count;
|
|
|
|
++to)
|
|
|
|
{
|
|
|
|
*to= param_iterator++;
|
|
|
|
}
|
|
|
|
}
|
2002-11-27 03:51:38 +01:00
|
|
|
return 0;
|
2002-11-22 19:04:42 +01:00
|
|
|
}
|
2002-10-02 12:33:08 +02:00
|
|
|
|
2003-01-11 09:36:13 +01:00
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
/*
|
2004-05-21 02:27:50 +02:00
|
|
|
Given a query string with parameter markers, create a Prepared Statement
|
|
|
|
from it and send PS info back to the client.
|
|
|
|
|
2004-04-12 23:58:48 +02:00
|
|
|
SYNOPSIS
|
|
|
|
mysql_stmt_prepare()
|
2004-05-21 02:27:50 +02:00
|
|
|
packet query to be prepared
|
|
|
|
packet_length query string length, including ignored trailing NULL or
|
|
|
|
quote char.
|
2004-04-12 23:58:48 +02:00
|
|
|
name NULL or statement name. For unnamed statements binary PS
|
2004-05-21 02:27:50 +02:00
|
|
|
protocol is used, for named statements text protocol is
|
2004-04-12 23:58:48 +02:00
|
|
|
used.
|
2004-05-21 02:27:50 +02:00
|
|
|
RETURN
|
|
|
|
0 OK, statement prepared successfully
|
|
|
|
other Error
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
This function parses the query and sends the total number of parameters
|
|
|
|
and resultset metadata information back to client (if any), without
|
|
|
|
executing the query i.e. without any log/disk writes. This allows the
|
|
|
|
queries to be re-executed without re-parsing during execute.
|
|
|
|
|
|
|
|
If parameter markers are found in the query, then store the information
|
|
|
|
using Item_param along with maintaining a list in lex->param_array, so
|
|
|
|
that a fast and direct retrieval can be made without going through all
|
|
|
|
field items.
|
2004-04-12 23:58:48 +02:00
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
*/
|
|
|
|
|
2004-04-12 23:58:48 +02:00
|
|
|
int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
|
|
|
|
LEX_STRING *name)
|
2002-06-12 23:13:12 +02:00
|
|
|
{
|
2003-12-20 00:16:10 +01:00
|
|
|
LEX *lex;
|
|
|
|
Prepared_statement *stmt= new Prepared_statement(thd);
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
int error;
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_ENTER("mysql_stmt_prepare");
|
2002-06-12 23:13:12 +02:00
|
|
|
|
2004-04-07 12:25:24 +02:00
|
|
|
DBUG_PRINT("prep_query", ("%s", packet));
|
2004-04-03 10:13:51 +02:00
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
if (stmt == 0)
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
{
|
|
|
|
send_error(thd, ER_OUT_OF_RESOURCES);
|
2004-04-12 23:58:48 +02:00
|
|
|
DBUG_RETURN(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name)
|
|
|
|
{
|
|
|
|
stmt->name.length= name->length;
|
2004-06-23 16:57:34 +02:00
|
|
|
if (!(stmt->name.str= memdup_root(&stmt->mem_root, (char*)name->str,
|
2004-04-30 18:44:46 +02:00
|
|
|
name->length)))
|
2004-04-12 23:58:48 +02:00
|
|
|
{
|
|
|
|
delete stmt;
|
|
|
|
send_error(thd, ER_OUT_OF_RESOURCES);
|
|
|
|
DBUG_RETURN(1);
|
|
|
|
}
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
}
|
2002-10-02 12:33:08 +02:00
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
if (thd->stmt_map.insert(stmt))
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
{
|
|
|
|
delete stmt;
|
|
|
|
send_error(thd, ER_OUT_OF_RESOURCES);
|
2004-04-12 23:58:48 +02:00
|
|
|
DBUG_RETURN(1);
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
}
|
2003-01-03 12:52:53 +01:00
|
|
|
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
thd->set_n_backup_statement(stmt, &thd->stmt_backup);
|
|
|
|
thd->set_n_backup_item_arena(stmt, &thd->stmt_backup);
|
2003-01-03 12:52:53 +01:00
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
if (alloc_query(thd, packet, packet_length))
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
{
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
thd->restore_backup_statement(stmt, &thd->stmt_backup);
|
|
|
|
thd->restore_backup_item_arena(stmt, &thd->stmt_backup);
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
/* Statement map deletes statement on erase */
|
|
|
|
thd->stmt_map.erase(stmt);
|
|
|
|
send_error(thd, ER_OUT_OF_RESOURCES);
|
2004-04-12 23:58:48 +02:00
|
|
|
DBUG_RETURN(1);
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
}
|
2003-12-20 00:16:10 +01:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
mysql_log.write(thd, COM_PREPARE, "%s", packet);
|
2003-12-20 00:16:10 +01:00
|
|
|
|
2004-05-20 01:02:49 +02:00
|
|
|
thd->current_arena= stmt;
|
2004-07-21 21:44:12 +02:00
|
|
|
mysql_init_query(thd, (uchar *) thd->query, thd->query_length);
|
2004-10-26 18:30:01 +02:00
|
|
|
/* Reset warnings from previous command */
|
|
|
|
mysql_reset_errors(thd);
|
2004-07-21 21:44:12 +02:00
|
|
|
lex= thd->lex;
|
2003-12-20 00:16:10 +01:00
|
|
|
lex->safe_to_cache_query= 0;
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
error= yyparse((void *)thd) || thd->is_fatal_error ||
|
2004-10-28 00:54:32 +02:00
|
|
|
thd->net.report_error || init_param_array(stmt);
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
/*
|
|
|
|
While doing context analysis of the query (in send_prepare_results) we
|
|
|
|
allocate a lot of additional memory: for open tables, JOINs, derived
|
|
|
|
tables, etc. Let's save a snapshot of current parse tree to the
|
|
|
|
statement and restore original THD. In cases when some tree
|
|
|
|
transformation can be reused on execute, we set again thd->mem_root from
|
|
|
|
stmt->mem_root (see setup_wild for one place where we do that).
|
|
|
|
*/
|
|
|
|
thd->restore_backup_item_arena(stmt, &thd->stmt_backup);
|
|
|
|
|
|
|
|
if (!error)
|
|
|
|
error= send_prepare_results(stmt, test(name));
|
2002-06-12 23:13:12 +02:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
/* restore to WAIT_PRIOR: QUERY_PRIOR is set inside alloc_query */
|
2002-06-12 23:13:12 +02:00
|
|
|
if (!(specialflag & SPECIAL_NO_PRIOR))
|
2002-11-22 19:04:42 +01:00
|
|
|
my_pthread_setprio(pthread_self(),WAIT_PRIOR);
|
2004-04-07 19:07:44 +02:00
|
|
|
if (error && thd->lex->sphead)
|
2003-12-20 15:43:24 +01:00
|
|
|
{
|
|
|
|
if (lex != thd->lex)
|
|
|
|
thd->lex->sphead->restore_lex(thd);
|
|
|
|
delete thd->lex->sphead;
|
|
|
|
thd->lex->sphead= NULL;
|
|
|
|
}
|
2003-12-20 00:16:10 +01:00
|
|
|
lex_end(lex);
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
thd->restore_backup_statement(stmt, &thd->stmt_backup);
|
|
|
|
cleanup_items(stmt->free_list);
|
|
|
|
close_thread_tables(thd);
|
2004-10-08 00:21:19 +02:00
|
|
|
thd->rollback_item_tree_changes();
|
2004-09-15 21:10:31 +02:00
|
|
|
thd->cleanup_after_query();
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
thd->current_arena= thd;
|
2002-06-12 23:13:12 +02:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
if (error)
|
2002-10-02 12:33:08 +02:00
|
|
|
{
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
/* Statement map deletes statement on erase */
|
|
|
|
thd->stmt_map.erase(stmt);
|
2004-04-05 17:43:37 +02:00
|
|
|
stmt= NULL;
|
2004-10-28 00:54:32 +02:00
|
|
|
if (thd->net.report_error)
|
|
|
|
send_error(thd);
|
|
|
|
/* otherwise the error is sent inside yyparse/send_prepare_results */
|
2002-10-02 12:33:08 +02:00
|
|
|
}
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
else
|
2004-07-15 03:19:07 +02:00
|
|
|
{
|
|
|
|
stmt->setup_set_params();
|
|
|
|
SELECT_LEX *sl= stmt->lex->all_selects_list;
|
|
|
|
/*
|
|
|
|
Save WHERE clause pointers, because they may be changed during query
|
|
|
|
optimisation.
|
|
|
|
*/
|
|
|
|
for (; sl; sl= sl->next_select_in_list())
|
|
|
|
sl->prep_where= sl->where;
|
2004-08-31 12:07:02 +02:00
|
|
|
stmt->state= Item_arena::PREPARED;
|
2004-07-15 03:19:07 +02:00
|
|
|
}
|
2004-04-12 23:58:48 +02:00
|
|
|
DBUG_RETURN(!stmt);
|
2002-06-12 23:13:12 +02:00
|
|
|
}
|
|
|
|
|
2004-11-03 11:39:38 +01:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
/* Reinit statement before execution */
|
2002-06-12 23:13:12 +02:00
|
|
|
|
2004-05-20 01:02:49 +02:00
|
|
|
void reset_stmt_for_execute(THD *thd, LEX *lex)
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
{
|
2004-05-20 01:02:49 +02:00
|
|
|
SELECT_LEX *sl= lex->all_selects_list;
|
2004-11-03 11:39:38 +01:00
|
|
|
DBUG_ENTER("reset_stmt_for_execute");
|
2002-06-12 23:13:12 +02:00
|
|
|
|
2004-07-16 00:15:55 +02:00
|
|
|
if (lex->empty_field_list_on_rset)
|
|
|
|
{
|
|
|
|
lex->empty_field_list_on_rset= 0;
|
2004-09-03 20:43:04 +02:00
|
|
|
lex->field_list.empty();
|
2004-07-16 00:15:55 +02:00
|
|
|
}
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
for (; sl; sl= sl->next_select_in_list())
|
2003-09-02 18:56:55 +02:00
|
|
|
{
|
2004-05-20 01:02:49 +02:00
|
|
|
if (!sl->first_execution)
|
|
|
|
{
|
2004-07-07 10:29:39 +02:00
|
|
|
/* remove option which was put by mysql_explain_union() */
|
|
|
|
sl->options&= ~SELECT_DESCRIBE;
|
|
|
|
|
2004-05-20 01:02:49 +02:00
|
|
|
/*
|
|
|
|
Copy WHERE clause pointers to avoid damaging they by optimisation
|
|
|
|
*/
|
|
|
|
if (sl->prep_where)
|
2004-07-23 18:54:01 +02:00
|
|
|
{
|
2004-05-20 01:02:49 +02:00
|
|
|
sl->where= sl->prep_where->copy_andor_structure(thd);
|
2004-07-23 18:54:01 +02:00
|
|
|
sl->where->cleanup();
|
|
|
|
}
|
2004-05-20 01:02:49 +02:00
|
|
|
DBUG_ASSERT(sl->join == 0);
|
|
|
|
ORDER *order;
|
|
|
|
/* Fix GROUP list */
|
|
|
|
for (order= (ORDER *)sl->group_list.first; order; order= order->next)
|
|
|
|
order->item= &order->item_ptr;
|
|
|
|
/* Fix ORDER list */
|
|
|
|
for (order= (ORDER *)sl->order_list.first; order; order= order->next)
|
|
|
|
order->item= &order->item_ptr;
|
|
|
|
}
|
2004-02-08 19:14:13 +01:00
|
|
|
{
|
2004-07-16 00:15:55 +02:00
|
|
|
TABLE_LIST *tables= (TABLE_LIST *)sl->table_list.first;
|
|
|
|
if (tables)
|
|
|
|
tables->setup_is_done= 0;
|
2004-02-08 19:14:13 +01:00
|
|
|
}
|
2004-02-12 17:50:00 +01:00
|
|
|
{
|
|
|
|
SELECT_LEX_UNIT *unit= sl->master_unit();
|
|
|
|
unit->unclean();
|
|
|
|
unit->types.empty();
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
/* for derived tables & PS (which can't be reset by Item_subquery) */
|
2004-02-12 17:50:00 +01:00
|
|
|
unit->reinit_exec_mechanism();
|
|
|
|
}
|
2003-09-02 18:56:55 +02:00
|
|
|
}
|
2004-07-16 00:15:55 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
TODO: When the new table structure is ready, then have a status bit
|
|
|
|
to indicate the table is altered, and re-do the setup_*
|
|
|
|
and open the tables back.
|
|
|
|
*/
|
|
|
|
for (TABLE_LIST *tables= lex->query_tables;
|
|
|
|
tables;
|
|
|
|
tables= tables->next_global)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
Reset old pointers to TABLEs: they are not valid since the tables
|
|
|
|
were closed in the end of previous prepare or execute call.
|
|
|
|
*/
|
|
|
|
tables->table= 0;
|
|
|
|
}
|
2004-07-01 00:52:05 +02:00
|
|
|
lex->current_select= &lex->select_lex;
|
2004-08-24 18:17:11 +02:00
|
|
|
if (lex->result)
|
|
|
|
lex->result->cleanup();
|
2004-11-03 11:39:38 +01:00
|
|
|
|
|
|
|
DBUG_VOID_RETURN;
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
}
|
|
|
|
|
2004-05-04 17:08:19 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
Clears parameters from data left from previous execution or long data
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
reset_stmt_params()
|
|
|
|
stmt - prepared statement for which parameters should be reset
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void reset_stmt_params(Prepared_statement *stmt)
|
|
|
|
{
|
|
|
|
Item_param **item= stmt->param_array;
|
|
|
|
Item_param **end= item + stmt->param_count;
|
|
|
|
for (;item < end ; ++item)
|
|
|
|
(**item).reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
/*
|
|
|
|
Executes previously prepared query.
|
|
|
|
If there is any parameters, then replace markers with the data supplied
|
|
|
|
from client, and then execute the query.
|
2004-06-07 10:09:10 +02:00
|
|
|
SYNOPSIS
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
mysql_stmt_execute()
|
2004-06-07 10:09:10 +02:00
|
|
|
thd Current thread
|
|
|
|
packet Query string
|
|
|
|
packet_length Query string length, including terminator character.
|
2002-06-12 23:13:12 +02:00
|
|
|
*/
|
|
|
|
|
2004-03-15 18:20:47 +01:00
|
|
|
void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
|
2002-06-12 23:13:12 +02:00
|
|
|
{
|
2003-10-15 21:40:36 +02:00
|
|
|
ulong stmt_id= uint4korr(packet);
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
ulong flags= (ulong) ((uchar) packet[4]);
|
2004-06-07 10:09:10 +02:00
|
|
|
/*
|
|
|
|
Query text for binary log, or empty string if the query is not put into
|
|
|
|
binary log.
|
|
|
|
*/
|
|
|
|
String expanded_query;
|
2004-04-05 12:56:05 +02:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
2004-03-31 00:27:49 +02:00
|
|
|
uchar *packet_end= (uchar *) packet + packet_length - 1;
|
2004-04-05 12:56:05 +02:00
|
|
|
#endif
|
2003-12-20 00:16:10 +01:00
|
|
|
Prepared_statement *stmt;
|
|
|
|
DBUG_ENTER("mysql_stmt_execute");
|
2004-03-31 00:27:49 +02:00
|
|
|
|
|
|
|
packet+= 9; /* stmt_id + 5 bytes of flags */
|
2004-06-07 10:09:10 +02:00
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute",
|
|
|
|
SEND_ERROR)))
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
|
2004-04-07 12:25:24 +02:00
|
|
|
DBUG_PRINT("exec_query:", ("%s", stmt->query));
|
2004-04-03 10:13:51 +02:00
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
/* Check if we got an error when sending long data */
|
2004-08-31 12:07:02 +02:00
|
|
|
if (stmt->state == Item_arena::ERROR)
|
2002-10-02 12:33:08 +02:00
|
|
|
{
|
2002-11-22 19:04:42 +01:00
|
|
|
send_error(thd, stmt->last_errno, stmt->last_error);
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
2004-10-14 00:53:59 +02:00
|
|
|
DBUG_ASSERT(thd->free_list == NULL);
|
|
|
|
mysql_reset_thd_for_next_command(thd);
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
if (flags & (ulong) CURSOR_TYPE_READ_ONLY)
|
|
|
|
{
|
2004-11-03 11:39:38 +01:00
|
|
|
if (!stmt->lex->result || !stmt->lex->result->simple_select())
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
{
|
2004-11-03 11:39:38 +01:00
|
|
|
DBUG_PRINT("info",("Cursor asked for not SELECT stmt"));
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
/*
|
|
|
|
If lex->result is set in the parser, this is not a SELECT
|
|
|
|
statement: we can't open a cursor for it.
|
|
|
|
*/
|
|
|
|
flags= 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-11-03 11:39:38 +01:00
|
|
|
DBUG_PRINT("info",("Using READ_ONLY cursor"));
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
if (!stmt->cursor &&
|
|
|
|
!(stmt->cursor= new (&stmt->mem_root) Cursor()))
|
|
|
|
{
|
|
|
|
send_error(thd, ER_OUT_OF_RESOURCES);
|
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
/* If lex->result is set, mysql_execute_command will use it */
|
|
|
|
stmt->lex->result= &stmt->cursor->result;
|
|
|
|
}
|
|
|
|
}
|
2003-09-17 17:48:53 +02:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
if (stmt->param_count)
|
2003-09-02 18:56:55 +02:00
|
|
|
{
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
uchar *null_array= (uchar *) packet;
|
2004-03-15 18:20:47 +01:00
|
|
|
if (setup_conversion_functions(stmt, (uchar **) &packet, packet_end) ||
|
2004-05-24 19:08:22 +02:00
|
|
|
stmt->set_params(stmt, null_array, (uchar *) packet, packet_end,
|
2004-06-07 10:09:10 +02:00
|
|
|
&expanded_query))
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
goto set_params_data_err;
|
2003-09-02 18:56:55 +02:00
|
|
|
}
|
2003-09-17 17:48:53 +02:00
|
|
|
#else
|
2003-12-20 00:16:10 +01:00
|
|
|
/*
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
In embedded library we re-install conversion routines each time
|
|
|
|
we set params, and also we don't need to parse packet.
|
|
|
|
So we do it in one function.
|
2003-12-20 00:16:10 +01:00
|
|
|
*/
|
2004-06-01 15:27:40 +02:00
|
|
|
if (stmt->param_count && stmt->set_params_data(stmt, &expanded_query))
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
goto set_params_data_err;
|
2003-09-17 17:48:53 +02:00
|
|
|
#endif
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
thd->stmt_backup.set_statement(thd);
|
|
|
|
thd->set_statement(stmt);
|
2004-07-01 00:52:05 +02:00
|
|
|
thd->current_arena= stmt;
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
reset_stmt_for_execute(thd, stmt->lex);
|
|
|
|
/* From now cursors assume that thd->mem_root is clean */
|
|
|
|
if (expanded_query.length() &&
|
|
|
|
alloc_query(thd, (char *)expanded_query.ptr(),
|
|
|
|
expanded_query.length()+1))
|
|
|
|
{
|
|
|
|
my_error(ER_OUTOFMEMORY, 0, expanded_query.length());
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
thd->protocol= &thd->protocol_prep; // Switch to binary protocol
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
if (!(specialflag & SPECIAL_NO_PRIOR))
|
|
|
|
my_pthread_setprio(pthread_self(),QUERY_PRIOR);
|
|
|
|
mysql_execute_command(thd);
|
|
|
|
if (!(specialflag & SPECIAL_NO_PRIOR))
|
|
|
|
my_pthread_setprio(pthread_self(), WAIT_PRIOR);
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
thd->protocol= &thd->protocol_simple; // Use normal protocol
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
|
|
|
|
if (flags & (ulong) CURSOR_TYPE_READ_ONLY)
|
|
|
|
{
|
|
|
|
if (stmt->cursor->is_open())
|
|
|
|
stmt->cursor->init_from_thd(thd);
|
|
|
|
thd->set_item_arena(&thd->stmt_backup);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
thd->lex->unit.cleanup();
|
|
|
|
cleanup_items(stmt->free_list);
|
|
|
|
reset_stmt_params(stmt);
|
|
|
|
close_thread_tables(thd); /* to close derived tables */
|
2004-11-03 11:39:38 +01:00
|
|
|
thd->rollback_item_tree_changes();
|
2004-09-15 21:10:31 +02:00
|
|
|
thd->cleanup_after_query();
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
thd->set_statement(&thd->stmt_backup);
|
2004-09-09 05:59:26 +02:00
|
|
|
thd->current_arena= thd;
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
DBUG_VOID_RETURN;
|
2002-11-22 19:04:42 +01:00
|
|
|
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
set_params_data_err:
|
2004-05-04 17:08:19 +02:00
|
|
|
reset_stmt_params(stmt);
|
2004-05-25 06:15:50 +02:00
|
|
|
my_error(ER_WRONG_ARGUMENTS, MYF(0), "mysql_stmt_execute");
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
err:
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
send_error(thd);
|
2002-06-12 23:13:12 +02:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
|
2004-04-05 17:43:37 +02:00
|
|
|
/*
|
2004-06-07 10:09:10 +02:00
|
|
|
Execute prepared statement using parameter values from
|
2004-04-05 17:43:37 +02:00
|
|
|
lex->prepared_stmt_params and send result to the client using text protocol.
|
|
|
|
*/
|
|
|
|
|
2004-04-12 23:58:48 +02:00
|
|
|
void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name)
|
2004-04-05 17:43:37 +02:00
|
|
|
{
|
2004-04-12 23:58:48 +02:00
|
|
|
Prepared_statement *stmt;
|
2004-05-25 00:03:49 +02:00
|
|
|
/*
|
2004-06-07 10:09:10 +02:00
|
|
|
Query text for binary log, or empty string if the query is not put into
|
|
|
|
binary log.
|
2004-05-05 11:40:33 +02:00
|
|
|
*/
|
2004-05-24 19:08:22 +02:00
|
|
|
String expanded_query;
|
2004-05-21 02:27:50 +02:00
|
|
|
DBUG_ENTER("mysql_sql_stmt_execute");
|
2004-06-07 10:09:10 +02:00
|
|
|
|
2004-09-09 05:59:26 +02:00
|
|
|
DBUG_ASSERT(thd->free_list == NULL);
|
|
|
|
|
2004-04-12 23:58:48 +02:00
|
|
|
if (!(stmt= (Prepared_statement*)thd->stmt_map.find_by_name(stmt_name)))
|
|
|
|
{
|
2004-05-21 02:27:50 +02:00
|
|
|
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), stmt_name->length,
|
|
|
|
stmt_name->str, "EXECUTE");
|
|
|
|
send_error(thd);
|
|
|
|
DBUG_VOID_RETURN;
|
2004-04-12 23:58:48 +02:00
|
|
|
}
|
|
|
|
|
2004-04-05 17:43:37 +02:00
|
|
|
if (stmt->param_count != thd->lex->prepared_stmt_params.elements)
|
|
|
|
{
|
2004-06-07 10:09:10 +02:00
|
|
|
my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE");
|
2004-04-05 17:43:37 +02:00
|
|
|
send_error(thd);
|
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
2004-10-14 00:53:59 +02:00
|
|
|
/* Must go before setting variables, as it clears thd->user_var_events */
|
|
|
|
mysql_reset_thd_for_next_command(thd);
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
thd->set_n_backup_statement(stmt, &thd->stmt_backup);
|
2004-06-01 15:27:40 +02:00
|
|
|
thd->set_statement(stmt);
|
2004-06-07 10:09:10 +02:00
|
|
|
if (stmt->set_params_from_vars(stmt,
|
|
|
|
thd->stmt_backup.lex->prepared_stmt_params,
|
2004-05-24 19:08:22 +02:00
|
|
|
&expanded_query))
|
2004-04-05 17:43:37 +02:00
|
|
|
{
|
2004-06-07 10:09:10 +02:00
|
|
|
my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE");
|
2004-04-05 17:43:37 +02:00
|
|
|
send_error(thd);
|
|
|
|
}
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
execute_stmt(thd, stmt, &expanded_query);
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
DBUG_VOID_RETURN;
|
2004-04-12 23:58:48 +02:00
|
|
|
}
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
|
2004-05-24 19:08:22 +02:00
|
|
|
|
2004-04-12 23:58:48 +02:00
|
|
|
/*
|
|
|
|
Execute prepared statement.
|
2004-05-24 19:08:22 +02:00
|
|
|
SYNOPSIS
|
|
|
|
execute_stmt()
|
|
|
|
thd Current thread
|
|
|
|
stmt Statement to execute
|
2004-06-07 10:09:10 +02:00
|
|
|
expanded_query If binary log is enabled, query string with parameter
|
2004-05-24 19:08:22 +02:00
|
|
|
placeholders replaced with actual values. Otherwise empty
|
|
|
|
string.
|
|
|
|
NOTES
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
Caller must set parameter values and thd::protocol.
|
2004-04-12 23:58:48 +02:00
|
|
|
*/
|
2004-05-24 19:08:22 +02:00
|
|
|
|
2004-06-07 10:09:10 +02:00
|
|
|
static void execute_stmt(THD *thd, Prepared_statement *stmt,
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
String *expanded_query)
|
2004-04-12 23:58:48 +02:00
|
|
|
{
|
|
|
|
DBUG_ENTER("execute_stmt");
|
2004-09-06 14:14:10 +02:00
|
|
|
|
2004-07-12 06:43:38 +02:00
|
|
|
reset_stmt_for_execute(thd, stmt->lex);
|
2004-06-07 10:09:10 +02:00
|
|
|
|
|
|
|
if (expanded_query->length() &&
|
|
|
|
alloc_query(thd, (char *)expanded_query->ptr(),
|
2004-05-24 19:08:22 +02:00
|
|
|
expanded_query->length()+1))
|
|
|
|
{
|
|
|
|
my_error(ER_OUTOFMEMORY, 0, expanded_query->length());
|
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
/*
|
|
|
|
At first execution of prepared statement we will perform logical
|
|
|
|
transformations of the query tree (i.e. negations elimination).
|
|
|
|
This should be done permanently on the parse tree of this statement.
|
|
|
|
*/
|
2004-10-08 00:21:19 +02:00
|
|
|
thd->current_arena= stmt;
|
2002-10-02 12:33:08 +02:00
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
if (!(specialflag & SPECIAL_NO_PRIOR))
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
my_pthread_setprio(pthread_self(),QUERY_PRIOR);
|
2003-01-30 09:38:11 +01:00
|
|
|
mysql_execute_command(thd);
|
2002-06-12 23:13:12 +02:00
|
|
|
if (!(specialflag & SPECIAL_NO_PRIOR))
|
2002-10-02 12:33:08 +02:00
|
|
|
my_pthread_setprio(pthread_self(), WAIT_PRIOR);
|
2003-01-18 21:58:19 +01:00
|
|
|
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
thd->lex->unit.cleanup();
|
2004-10-08 00:21:19 +02:00
|
|
|
thd->current_arena= thd;
|
2003-12-30 11:08:19 +01:00
|
|
|
cleanup_items(stmt->free_list);
|
2004-10-08 00:21:19 +02:00
|
|
|
thd->rollback_item_tree_changes();
|
2004-05-04 17:08:19 +02:00
|
|
|
reset_stmt_params(stmt);
|
2004-06-07 10:09:10 +02:00
|
|
|
close_thread_tables(thd); // to close derived tables
|
2003-12-20 00:16:10 +01:00
|
|
|
thd->set_statement(&thd->stmt_backup);
|
2004-09-15 21:10:31 +02:00
|
|
|
thd->cleanup_after_query();
|
|
|
|
|
2004-08-31 12:07:02 +02:00
|
|
|
if (stmt->state == Item_arena::PREPARED)
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
{
|
|
|
|
thd->current_arena= thd;
|
2004-08-31 12:07:02 +02:00
|
|
|
stmt->state= Item_arena::EXECUTED;
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
}
|
2002-06-12 23:13:12 +02:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
/*
|
|
|
|
COM_FETCH handler: fetches requested amount of rows from cursor
|
|
|
|
SYNOPSIS
|
|
|
|
*/
|
|
|
|
|
|
|
|
void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
|
|
|
|
{
|
|
|
|
/* assume there is always place for 8-16 bytes */
|
|
|
|
ulong stmt_id= uint4korr(packet);
|
|
|
|
ulong num_rows= uint4korr(packet+=4);
|
|
|
|
Statement *stmt;
|
|
|
|
int error;
|
|
|
|
|
|
|
|
DBUG_ENTER("mysql_stmt_fetch");
|
|
|
|
|
|
|
|
if (!(stmt= thd->stmt_map.find(stmt_id)) ||
|
|
|
|
!stmt->cursor ||
|
|
|
|
!stmt->cursor->is_open())
|
|
|
|
{
|
|
|
|
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), stmt_id, "fetch");
|
|
|
|
send_error(thd);
|
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
|
|
|
thd->stmt_backup.set_statement(thd);
|
|
|
|
thd->stmt_backup.set_item_arena(thd);
|
|
|
|
thd->set_statement(stmt);
|
|
|
|
stmt->cursor->init_thd(thd);
|
|
|
|
|
|
|
|
if (!(specialflag & SPECIAL_NO_PRIOR))
|
|
|
|
my_pthread_setprio(pthread_self(), QUERY_PRIOR);
|
|
|
|
|
|
|
|
thd->protocol= &thd->protocol_prep; // Switch to binary protocol
|
|
|
|
error= stmt->cursor->fetch(num_rows);
|
|
|
|
thd->protocol= &thd->protocol_simple; // Use normal protocol
|
|
|
|
|
|
|
|
if (!(specialflag & SPECIAL_NO_PRIOR))
|
|
|
|
my_pthread_setprio(pthread_self(), WAIT_PRIOR);
|
|
|
|
|
|
|
|
/* Restore THD state */
|
|
|
|
stmt->cursor->reset_thd(thd);
|
|
|
|
thd->set_statement(&thd->stmt_backup);
|
|
|
|
thd->set_item_arena(&thd->stmt_backup);
|
|
|
|
|
|
|
|
if (error && error != -4)
|
|
|
|
send_error(thd, ER_OUT_OF_RESOURCES);
|
|
|
|
|
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-12 23:13:12 +02:00
|
|
|
/*
|
2004-05-24 19:08:22 +02:00
|
|
|
Reset a prepared statement in case there was a recoverable error.
|
2002-10-02 12:33:08 +02:00
|
|
|
SYNOPSIS
|
|
|
|
mysql_stmt_reset()
|
2004-05-24 19:08:22 +02:00
|
|
|
thd Thread handle
|
|
|
|
packet Packet with stmt id
|
2002-10-02 12:33:08 +02:00
|
|
|
|
|
|
|
DESCRIPTION
|
2004-05-06 20:44:00 +02:00
|
|
|
This function resets statement to the state it was right after prepare.
|
|
|
|
It can be used to:
|
|
|
|
- clear an error happened during mysql_stmt_send_long_data
|
|
|
|
- cancel long data stream for all placeholders without
|
|
|
|
having to call mysql_stmt_execute.
|
|
|
|
Sends 'OK' packet in case of success (statement was reset)
|
|
|
|
or 'ERROR' packet (unrecoverable error/statement not found/etc).
|
2002-06-12 23:13:12 +02:00
|
|
|
*/
|
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
void mysql_stmt_reset(THD *thd, char *packet)
|
2002-06-12 23:13:12 +02:00
|
|
|
{
|
2004-03-15 18:20:47 +01:00
|
|
|
/* There is always space for 4 bytes in buffer */
|
2002-10-02 12:33:08 +02:00
|
|
|
ulong stmt_id= uint4korr(packet);
|
2003-12-20 00:16:10 +01:00
|
|
|
Prepared_statement *stmt;
|
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_ENTER("mysql_stmt_reset");
|
2002-06-12 23:13:12 +02:00
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset",
|
|
|
|
SEND_ERROR)))
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
|
2004-08-31 12:07:02 +02:00
|
|
|
stmt->state= Item_arena::PREPARED;
|
2002-10-02 12:33:08 +02:00
|
|
|
|
2004-05-04 17:08:19 +02:00
|
|
|
/*
|
|
|
|
Clear parameters from data which could be set by
|
|
|
|
mysql_stmt_send_long_data() call.
|
|
|
|
*/
|
|
|
|
reset_stmt_params(stmt);
|
2004-05-06 20:44:00 +02:00
|
|
|
|
2004-10-14 00:53:59 +02:00
|
|
|
mysql_reset_thd_for_next_command(thd);
|
2004-05-06 20:44:00 +02:00
|
|
|
send_ok(thd);
|
2004-05-04 17:08:19 +02:00
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
Delete a prepared statement from memory.
|
|
|
|
Note: we don't send any reply to that command.
|
2002-10-02 12:33:08 +02:00
|
|
|
*/
|
|
|
|
|
2002-11-27 03:51:38 +01:00
|
|
|
void mysql_stmt_free(THD *thd, char *packet)
|
2002-10-02 12:33:08 +02:00
|
|
|
{
|
2004-03-15 18:20:47 +01:00
|
|
|
/* There is always space for 4 bytes in packet buffer */
|
2002-10-02 12:33:08 +02:00
|
|
|
ulong stmt_id= uint4korr(packet);
|
2003-12-20 00:16:10 +01:00
|
|
|
Prepared_statement *stmt;
|
|
|
|
|
2002-11-27 03:51:38 +01:00
|
|
|
DBUG_ENTER("mysql_stmt_free");
|
2002-10-02 12:33:08 +02:00
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_close",
|
|
|
|
DONT_SEND_ERROR)))
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_VOID_RETURN;
|
2003-12-20 00:16:10 +01:00
|
|
|
|
|
|
|
/* Statement map deletes statement on erase */
|
|
|
|
thd->stmt_map.erase(stmt);
|
2002-06-12 23:13:12 +02:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
|
|
|
|
/*
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
Long data in pieces from client
|
2002-10-02 12:33:08 +02:00
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
mysql_stmt_get_longdata()
|
|
|
|
thd Thread handle
|
|
|
|
pos String to append
|
|
|
|
packet_length Length of string
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Get a part of a long data.
|
|
|
|
To make the protocol efficient, we are not sending any return packages
|
|
|
|
here.
|
|
|
|
If something goes wrong, then we will send the error on 'execute'
|
|
|
|
|
|
|
|
We assume that the client takes care of checking that all parts are sent
|
|
|
|
to the server. (No checking that we get a 'end of column' in the server)
|
|
|
|
*/
|
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
|
2002-10-02 12:33:08 +02:00
|
|
|
{
|
2004-05-25 00:03:49 +02:00
|
|
|
ulong stmt_id;
|
|
|
|
uint param_number;
|
2003-12-20 00:16:10 +01:00
|
|
|
Prepared_statement *stmt;
|
2004-05-25 00:03:49 +02:00
|
|
|
Item_param *param;
|
|
|
|
char *packet_end= packet + packet_length - 1;
|
2003-12-20 00:16:10 +01:00
|
|
|
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_ENTER("mysql_stmt_get_longdata");
|
|
|
|
|
2003-10-06 13:32:38 +02:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
2004-05-25 00:03:49 +02:00
|
|
|
/* Minimal size of long data packet is 6 bytes */
|
|
|
|
if ((ulong) (packet_end - packet) < MYSQL_LONG_DATA_HEADER)
|
2002-10-02 12:33:08 +02:00
|
|
|
{
|
2004-05-25 00:03:49 +02:00
|
|
|
my_error(ER_WRONG_ARGUMENTS, MYF(0), "mysql_stmt_send_long_data");
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
2003-10-06 13:32:38 +02:00
|
|
|
#endif
|
2002-10-02 12:33:08 +02:00
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
stmt_id= uint4korr(packet);
|
|
|
|
packet+= 4;
|
2002-10-02 12:33:08 +02:00
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
if (!(stmt=find_prepared_statement(thd, stmt_id, "mysql_stmt_send_long_data",
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
DONT_SEND_ERROR)))
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
param_number= uint2korr(packet);
|
|
|
|
packet+= 2;
|
2003-10-06 13:32:38 +02:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
2002-10-02 12:33:08 +02:00
|
|
|
if (param_number >= stmt->param_count)
|
|
|
|
{
|
2002-12-07 08:39:11 +01:00
|
|
|
/* Error will be sent in execute call */
|
2004-08-31 12:07:02 +02:00
|
|
|
stmt->state= Item_arena::ERROR;
|
2002-12-07 08:39:11 +01:00
|
|
|
stmt->last_errno= ER_WRONG_ARGUMENTS;
|
2004-05-25 00:03:49 +02:00
|
|
|
sprintf(stmt->last_error, ER(ER_WRONG_ARGUMENTS),
|
|
|
|
"mysql_stmt_send_long_data");
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
2003-10-06 13:32:38 +02:00
|
|
|
#endif
|
|
|
|
|
2004-05-25 00:03:49 +02:00
|
|
|
param= stmt->param_array[param_number];
|
|
|
|
|
2003-10-06 13:32:38 +02:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
if (param->set_longdata(packet, (ulong) (packet_end - packet)))
|
2003-10-06 13:32:38 +02:00
|
|
|
#else
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
if (param->set_longdata(thd->extra_data, thd->extra_length))
|
2003-10-06 13:32:38 +02:00
|
|
|
#endif
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
{
|
2004-08-31 12:07:02 +02:00
|
|
|
stmt->state= Item_arena::ERROR;
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
stmt->last_errno= ER_OUTOFMEMORY;
|
|
|
|
sprintf(stmt->last_error, ER(ER_OUTOFMEMORY), 0);
|
|
|
|
}
|
2002-10-02 12:33:08 +02:00
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
2002-11-22 19:04:42 +01:00
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
|
|
|
|
Prepared_statement::Prepared_statement(THD *thd_arg)
|
|
|
|
:Statement(thd_arg),
|
|
|
|
thd(thd_arg),
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
param_array(0),
|
2003-12-20 00:16:10 +01:00
|
|
|
param_count(0),
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
last_errno(0)
|
2003-12-20 00:16:10 +01:00
|
|
|
{
|
|
|
|
*last_error= '\0';
|
|
|
|
}
|
|
|
|
|
2004-06-01 15:27:40 +02:00
|
|
|
void Prepared_statement::setup_set_params()
|
|
|
|
{
|
|
|
|
/* Setup binary logging */
|
|
|
|
if (mysql_bin_log.is_open() && is_update_query(lex->sql_command))
|
2003-12-20 00:16:10 +01:00
|
|
|
{
|
2004-06-01 15:27:40 +02:00
|
|
|
set_params_from_vars= insert_params_from_vars_with_log;
|
2003-12-20 00:16:10 +01:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
set_params= insert_params_withlog;
|
2003-12-20 00:16:10 +01:00
|
|
|
#else
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
set_params_data= emb_insert_params_withlog;
|
2003-12-20 00:16:10 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
2004-06-01 15:27:40 +02:00
|
|
|
{
|
|
|
|
set_params_from_vars= insert_params_from_vars;
|
2003-12-20 00:16:10 +01:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
set_params= insert_params;
|
2003-12-20 00:16:10 +01:00
|
|
|
#else
|
Desperate attempt to push part of prepared statements cleanup which was
reviewed in Saint-Petersbourg (including post-review fixes).
include/my_sys.h:
Added clear_alloc_root (reset alloc root without freeing its memory)
sql/item.h:
- rename setup_param -> set_parap (function assigns parameter value to item)
sql/mysql_priv.h:
- all return values are void, because return value is never checked in
dispatch_command
- removed unused declaration of setup_param_functions
sql/protocol.h:
- unused declarations of setup_params_data* removed
sql/sql_class.cc:
Cleanup:
- bzero(mem_root) replaced with clear_alloc_root
- query_id and command members moved back to THD from Statement
Assignment of mem_root, free_list, query_id and command optimized
away from set_statement().
sql/sql_class.h:
- query_id and command moved back to THD from Statement
sql/sql_lex.h:
- better type for param_list
- param_count is the same thing as param_list.elements
sql/sql_parse.cc:
- comments for dispatch_command
sql/sql_prepare.cc:
Cleanup:
- added comments to many functions and removed trailing spaces in many
lines, some stale comments removed.
- it's faster to iterate using pointers, than classes
- Renames: error_in_prepare renamed to get_longdata_error (because it is set
when there is an error in mysql_send_longdata, rather than in
mysql_prepare), embedded versions of placeholder assignement functions
now have prefix emb_, setup_ functions renamed to set_, because they
perform assignment, not installation, setup_params_data now doesn't
call insert_params and was renamed to setup_set_param_functions,
- find_prepared_statement should not send error if called from no-reply
calls, like mysql_stmt_reset
- error reporting is checked up, to always report errors and not report
errors twice. send_prep_stmt can be done mostly in send_prepare_result,
rather than in test_* functions.
- now we don't need to reinit THD->mem_root/free_list in mysql_stmt_execute,
because it's not reset there.
tests/client_test.c:
- removed second call to test_subqueries
2004-03-02 20:39:50 +01:00
|
|
|
set_params_data= emb_insert_params;
|
2003-12-20 00:16:10 +01:00
|
|
|
#endif
|
2004-06-01 15:27:40 +02:00
|
|
|
}
|
2003-12-20 00:16:10 +01:00
|
|
|
}
|
|
|
|
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
|
2003-12-20 00:16:10 +01:00
|
|
|
Prepared_statement::~Prepared_statement()
|
|
|
|
{
|
Port of cursors to be pushed into 5.0 tree:
- client side part is simple and may be considered stable
- server side part now just joggles with THD state to save execution
state and has no additional locking wisdom.
Lot's of it are to be rewritten.
include/mysql.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new statement attribute STMT_ATTR_CURSOR_TYPE
- MYSQL_STMT::flags to store statement cursor type
- MYSQL_STMT::server_status to store server status (i. e. if the server
was able to open a cursor for this query).
include/mysql_com.h:
Cursor patch to push into the main tree, client library part (considered
stable):
- new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
By design should support scrollable cursors as well.
- a few new server statuses:
SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
when cursor was successfully opened for this query
SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
more round trip just for finding out that all rows were fetched from
this cursor (this is server mem savier also).
- and finally, all possible values of STMT_ATTR_CURSOR_TYPE,
while now we support only CURSORT_TYPE_NO_CURSOR and
CURSOR_TYPE_READ_ONLY
libmysql/libmysql.c:
Cursor patch to push into the main tree, client library part (considered
stable):
- simple additions to mysql_stmt_fetch implementation to read data
from an opened cursor: we can read up to iteration count rows per
one request; read rows are buffered in the same way as rows of
mysql_stmt_store_result.
- now send stmt->flags to server to let him now if we wish to have
a cursor for this statement.
- support for setting/getting statement cursor type.
libmysqld/examples/Makefile.am:
Testing cursors was originally implemented in C++. Now when these tests
go into client_test, it's time to convert it to C++ as well.
libmysqld/lib_sql.cc:
- cleanup: send_fields flags are now named.
sql/ha_innodb.cc:
- cleanup: send_fields flags are now named.
sql/mysql_priv.h:
- cursors support: declaration for server-side handler of COM_FETCH
sql/protocol.cc:
- cleanup: send_fields flags are now named.
- we can't anymore assert that field_types[field_pos] is sensible:
if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
field_types[field_pos] will point to fields of stmt2.
sql/protocol.h:
- cleanup: send_fields flag_s_ are now named.
sql/protocol_cursor.cc:
- cleanup: send_fields flags are now named.
sql/repl_failsafe.cc:
- cleanup: send_fields flags are now named.
sql/slave.cc:
- cleanup: send_fields flags are now named.
sql/sp.cc:
- cleanup: send_fields flags are now named.
sql/sp_head.cc:
- cleanup: send_fields flags are now named.
sql/sql_acl.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.cc:
- cleanup: send_fields flags are now named.
sql/sql_class.h:
- cleanup: send_fields flags are now named.
sql/sql_error.cc:
- cleanup: send_fields flags are now named.
sql/sql_handler.cc:
- cleanup: send_fields flags are now named.
sql/sql_help.cc:
- cleanup: send_fields flags are now named.
sql/sql_parse.cc:
Server side support for cursors:
- handle COM_FETCH
- enforce assumption that whenever we free thd->free_list,
we reset it to zero. This way it's much easier to handle free_list
in prepared statements implementation.
sql/sql_prepare.cc:
Server side support for cursors:
- implementation of mysql_stmt_fetch (fetch some rows from open cursor).
- management of cursors memory is quite tricky now.
- execute_stmt can't be reused anymore in mysql_stmt_execute and
mysql_sql_stmt_execute
sql/sql_repl.cc:
- cleanup: send_fields flags are now named.
sql/sql_select.cc:
Server side support for cursors:
- implementation of Cursor::open, Cursor::fetch (buggy when it comes to
non-equi joins), cursor cleanups.
- -4 -3 -0 constants indicating return value of sub_select and end_send are
to be renamed to something more readable:
it turned out to be not so simple, so it should come with the other patch.
sql/sql_select.h:
Server side support for cursors:
- declaration of Cursor class.
- JOIN::fetch_limit contains runtime value of rows fetched via cursor.
sql/sql_show.cc:
- cleanup: send_fields flags are now named.
sql/sql_table.cc:
- cleanup: send_fields flags are now named.
sql/sql_union.cc:
- if there was a cursor, don't cleanup unit: we'll need it to fetch
the rest of the rows.
tests/Makefile.am:
Now client_test is in C++.
tests/client_test.cc:
A few elementary tests for cursors.
BitKeeper/etc/ignore:
Added libmysqld/examples/client_test.cc to the ignore list
2004-08-03 12:32:21 +02:00
|
|
|
if (cursor)
|
|
|
|
cursor->Cursor::~Cursor();
|
2003-12-20 00:16:10 +01:00
|
|
|
free_items(free_list);
|
2004-08-24 18:17:11 +02:00
|
|
|
delete lex->result;
|
2003-12-20 00:16:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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.
mysql-test/r/ps.result:
Test results updated (test case for Bug#4912)
mysql-test/t/ps.test:
A test case for Bug#4912 "mysqld crashs in case a statement is
executed a second time"
sql/item_cmpfunc.cc:
current_statement -> current_arena
sql/item_subselect.cc:
Statement -> Item_arena, current_statement -> current_arena
sql/item_subselect.h:
Item_subselect does not need to save thd->current_statement.
sql/item_sum.cc:
Statement -> Item_arena
sql/item_sum.h:
Statement -> Item_arena
sql/mysql_priv.h:
Statement -> Item_arena
sql/sql_base.cc:
current_statement -> current_arena
sql/sql_class.cc:
- Item_arena
- convenient set_n_backup_statement, restore_backup_statement
(nice idea, Sanja)
sql/sql_class.h:
- Item_arena: backport from 5.0
- allocate_temporary_pool_for_ps_preparing,
free_temporary_pool_for_ps_preparing removed.
sql/sql_derived.cc:
current_statement -> current_arena
sql/sql_lex.cc:
current_statement -> current_arena
sql/sql_parse.cc:
Deploy invariant that thd->free_list never contains junk items
(backport from 5.0).
sql/sql_prepare.cc:
- backporting Item_arena
- no need to allocate_temporary_pool_for_ps_preparing().
sql/sql_select.cc:
Fix for bug#4912 "mysqld crashs in case a statement is
executed a second time": if this is the first execute of
a prepared statement, negation elimination is
done in memory of the prepared statement.
sql/sql_union.cc:
Backporting Item_arena from 5.0.
2004-08-21 00:02:46 +02:00
|
|
|
Item_arena::Type Prepared_statement::type() const
|
2003-12-20 00:16:10 +01:00
|
|
|
{
|
|
|
|
return PREPARED_STATEMENT;
|
|
|
|
}
|