diff options
author | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-06-11 17:48:24 +0400 |
---|---|---|
committer | Alexey Kopytov <Alexey.Kopytov@Sun.com> | 2010-06-11 17:48:24 +0400 |
commit | f84b3f5c21c62ebe3b489250a09aca0ffde1313c (patch) | |
tree | bad36a3866fc1f57ed09d6de5a590fa2e12bacfe /sql/sql_lex.cc | |
parent | 26a034959299cb72d04d92ab330dfb83ef6082a6 (diff) | |
parent | e5cf56ef80391caca2f06b34fc1de1313196e91f (diff) | |
download | mariadb-git-f84b3f5c21c62ebe3b489250a09aca0ffde1313c.tar.gz |
Manual merge from mysql-5.1-bugteam to mysql-trunk-merge.
conflicts:
conflict mysys/safemalloc.c
conflict sql/mysqld.cc
conflict sql/sp.cc
conflict sql/sql_lex.cc
conflict sql/sql_lex.h
conflict sql/sql_parse.cc
conflict sql/sql_prepare.cc
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 82aa004a751..16b4c727689 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -147,20 +147,30 @@ st_parsing_options::reset() Perform initialization of Lex_input_stream instance. Basically, a buffer for pre-processed query. This buffer should be large - enough to keep multi-statement query. The allocation is done once in the - Lex_input_stream constructor in order to prevent memory pollution when + enough to keep multi-statement query. The allocation is done once in + Lex_input_stream::init() in order to prevent memory pollution when the server is processing large multi-statement queries. - - @todo Check return value of THD::alloc(). */ -Lex_input_stream::Lex_input_stream(THD *thd, - const char* buffer, - unsigned int length) - :m_thd(thd) +bool Lex_input_stream::init(THD *thd, + const char* buff, + unsigned int length) { + DBUG_EXECUTE_IF("bug42064_simulate_oom", + DBUG_SET("+d,simulate_out_of_memory");); + m_cpp_buf= (char*) thd->alloc(length + 1); - reset(buffer, length); + + DBUG_EXECUTE_IF("bug42064_simulate_oom", + DBUG_SET("-d,bug42064_simulate_oom");); + + if (m_cpp_buf == NULL) + return TRUE; + + m_thd= thd; + reset(buff, length); + + return FALSE; } @@ -203,8 +213,6 @@ Lex_input_stream::reset(const char *buffer, unsigned int length) m_cpp_ptr= m_cpp_buf; } -Lex_input_stream::~Lex_input_stream() -{} /** The operation is called from the parser in order to |