~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/delete.cc

  • Committer: pcrews
  • Date: 2011-05-24 17:36:24 UTC
  • mfrom: (1099.4.232 drizzle)
  • Revision ID: pcrews@lucid32-20110524173624-mwr1bvq6fa1r01ao
Updated translations + 2011.05.18 tarball tag

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include "config.h"
 
21
#include <config.h>
22
22
#include <drizzled/show.h>
23
23
#include <drizzled/session.h>
24
24
#include <drizzled/lock.h>
25
25
#include <drizzled/probes.h>
26
26
#include <drizzled/statement/delete.h>
 
27
#include <drizzled/sql_lex.h>
27
28
 
28
29
namespace drizzled
29
30
{
30
31
 
31
32
bool statement::Delete::execute()
32
33
{
33
 
  DRIZZLE_DELETE_START(getSession()->getQueryString()->c_str());
34
 
  TableList *first_table= (TableList *) getSession()->lex->select_lex.table_list.first;
35
 
  TableList *all_tables= getSession()->lex->query_tables;
36
 
  Select_Lex *select_lex= &getSession()->lex->select_lex;
37
 
  Select_Lex_Unit *unit= &getSession()->lex->unit;
 
34
  DRIZZLE_DELETE_START(session().getQueryString()->c_str());
 
35
  TableList *first_table= (TableList *) lex().select_lex.table_list.first;
 
36
  TableList *all_tables= lex().query_tables;
 
37
  Select_Lex *select_lex= &lex().select_lex;
 
38
  Select_Lex_Unit *unit= &lex().unit;
38
39
  assert(first_table == all_tables && first_table != 0);
39
40
  assert(select_lex->offset_limit == 0);
40
41
  unit->set_limit(select_lex);
41
42
  bool need_start_waiting= false;
42
43
 
43
 
  if (! (need_start_waiting= not getSession()->wait_if_global_read_lock(0, 1)))
 
44
  if (! (need_start_waiting= not session().wait_if_global_read_lock(0, 1)))
44
45
  {
45
46
    return true;
46
47
  }
47
48
 
48
 
  bool res= delete_query(getSession(), all_tables, select_lex->where,
 
49
  bool res= delete_query(&session(), all_tables, select_lex->where,
49
50
                         &select_lex->order_list,
50
51
                         unit->select_limit_cnt, select_lex->options,
51
52
                         false);
53
54
    Release the protection against the global read lock and wake
54
55
    everyone, who might want to set a global read lock.
55
56
  */
56
 
  getSession()->startWaitingGlobalReadLock();
 
57
  session().startWaitingGlobalReadLock();
57
58
 
58
59
  return res;
59
60
}