~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

Merge of Jay

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include <drizzled/select_send.h>
37
37
#include <drizzled/plugin/client.h>
38
38
#include <drizzled/statement.h>
 
39
#include "drizzled/probes.h"
39
40
 
40
41
#include <bitset>
41
42
#include <algorithm>
167
168
  bool error= 0;
168
169
  Query_id &query_id= Query_id::get_query_id();
169
170
 
170
 
  session->command=command;
 
171
  DRIZZLE_COMMAND_START(session->thread_id,
 
172
                        command);
 
173
 
 
174
  session->command= command;
171
175
  session->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
172
176
  session->set_time();
173
177
  session->query_id= query_id.value();
205
209
  {
206
210
    if (! session->readAndStoreQuery(packet, packet_length))
207
211
      break;                                    // fatal error is set
 
212
    DRIZZLE_QUERY_START(session->query,
 
213
                        session->thread_id,
 
214
                        const_cast<const char *>(session->db ? session->db : ""));
208
215
    const char* end_of_stmt= NULL;
209
216
 
210
217
    mysql_parse(session, session->query, session->query_length, &end_of_stmt);
295
302
 
296
303
  /* Store temp state for processlist */
297
304
  session->set_proc_info("cleaning up");
298
 
  session->command=COM_SLEEP;
 
305
  session->command= COM_SLEEP;
299
306
  memset(session->process_list_info, 0, PROCESS_LIST_WIDTH);
300
 
  session->query=0;
301
 
  session->query_length=0;
 
307
  session->query= 0;
 
308
  session->query_length= 0;
302
309
 
303
310
  session->set_proc_info(NULL);
304
311
  session->packet.shrink(session->variables.net_buffer_length); // Reclaim some memory
305
312
  free_root(session->mem_root,MYF(MY_KEEP_PREALLOC));
306
 
  return(error);
 
313
 
 
314
  if (DRIZZLE_QUERY_DONE_ENABLED() || DRIZZLE_COMMAND_DONE_ENABLED())
 
315
  {
 
316
    if (command == COM_QUERY)
 
317
    {
 
318
      DRIZZLE_QUERY_DONE(session->is_error());
 
319
    }
 
320
    DRIZZLE_COMMAND_DONE(session->is_error());
 
321
  }
 
322
 
 
323
  return error;
307
324
}
308
325
 
309
326
 
759
776
          if (*found_semicolon &&
760
777
              (session->query_length= (ulong)(*found_semicolon - session->query)))
761
778
            session->query_length--;
 
779
          DRIZZLE_QUERY_EXEC_START(session->query,
 
780
                                   session->thread_id,
 
781
                                   const_cast<const char *>(session->db ? session->db : ""));
762
782
          /* Actually execute the query */
763
783
          mysql_execute_command(session);
 
784
          DRIZZLE_QUERY_EXEC_DONE(0);
764
785
        }
765
786
      }
766
787
    }
1819
1840
{
1820
1841
  assert(session->m_lip == NULL);
1821
1842
 
 
1843
  DRIZZLE_QUERY_PARSE_START(session->query);
 
1844
 
1822
1845
  /* Set Lex_input_stream. */
1823
1846
 
1824
1847
  session->m_lip= lip;
1835
1858
 
1836
1859
  session->m_lip= NULL;
1837
1860
 
 
1861
  DRIZZLE_QUERY_PARSE_DONE(mysql_parse_status || session->is_fatal_error);
 
1862
 
1838
1863
  /* That's it. */
1839
1864
 
1840
1865
  return mysql_parse_status || session->is_fatal_error;