~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/delete.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

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>
28
27
 
29
28
namespace drizzled
30
29
{
31
30
 
32
31
bool statement::Delete::execute()
33
32
{
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;
 
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;
39
38
  assert(first_table == all_tables && first_table != 0);
40
39
  assert(select_lex->offset_limit == 0);
41
40
  unit->set_limit(select_lex);
42
41
  bool need_start_waiting= false;
43
42
 
44
 
  if (! (need_start_waiting= not session().wait_if_global_read_lock(0, 1)))
 
43
  if (! (need_start_waiting= not getSession()->wait_if_global_read_lock(0, 1)))
45
44
  {
46
45
    return true;
47
46
  }
48
47
 
49
 
  bool res= delete_query(&session(), all_tables, select_lex->where,
 
48
  bool res= delete_query(getSession(), all_tables, select_lex->where,
50
49
                         &select_lex->order_list,
51
50
                         unit->select_limit_cnt, select_lex->options,
52
51
                         false);
54
53
    Release the protection against the global read lock and wake
55
54
    everyone, who might want to set a global read lock.
56
55
  */
57
 
  session().startWaitingGlobalReadLock();
 
56
  getSession()->startWaitingGlobalReadLock();
58
57
 
59
58
  return res;
60
59
}