~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/user_locks/create_barrier.cc

  • Committer: Monty Taylor
  • Date: 2010-11-24 19:33:25 UTC
  • mto: (1953.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1955.
  • Revision ID: mordred@inaugust.com-20101124193325-7rxjg5jwto3lfms9
protobuf requires pthread. It's just the way it is.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
{
32
32
  drizzled::String *res= args[0]->val_str(&value);
33
33
 
34
 
  if (not res || not res->length())
 
34
  if (not res)
35
35
  {
36
 
    my_error(drizzled::ER_USER_LOCKS_INVALID_NAME_BARRIER, MYF(0));
 
36
    null_value= true;
37
37
    return 0;
38
38
  }
39
39
  null_value= false;
40
40
 
 
41
  if (not res->length())
 
42
    return 0;
 
43
 
41
44
  barriers::Storable *list= static_cast<barriers::Storable *>(getSession().getProperty(barriers::property_key));
42
45
 
43
 
  bool result;
 
46
  boost::tribool result;
44
47
 
45
 
  drizzled::identifier::User::const_shared_ptr user_identifier(getSession().user());
46
48
  if (arg_count == 2)
47
49
  {
48
50
    int64_t wait_for;
49
51
    wait_for= args[1]->val_int();
50
52
 
51
 
    result= Barriers::getInstance().create(Key(*user_identifier, res->c_str()), getSession().getSessionId(), wait_for);
 
53
    result= Barriers::getInstance().create(Key(getSession().getSecurityContext(), res->c_str()), getSession().getSessionId(), wait_for);
52
54
  }
53
55
  else
54
56
  {
55
 
    result= Barriers::getInstance().create(Key(*user_identifier, res->c_str()), getSession().getSessionId());
 
57
    result= Barriers::getInstance().create(Key(getSession().getSecurityContext(), res->c_str()), getSession().getSessionId());
56
58
  }
57
59
 
58
60
 
 
61
  if (boost::indeterminate(result))
 
62
    null_value= true;
 
63
 
59
64
  if (result)
60
65
  {
61
66
    if (not list)
64
69
      getSession().setProperty(barriers::property_key, list);
65
70
    }
66
71
 
67
 
    list->insert(Key(*user_identifier, res->c_str()));
 
72
    list->insert(Key(getSession().getSecurityContext(), res->c_str()));
68
73
 
69
74
    return 1;
70
75
  }