~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/user_locks/get_lock.cc

  • Committer: Brian Aker
  • Date: 2010-12-18 10:14:05 UTC
  • mfrom: (2008.1.3 clean)
  • Revision ID: brian@tangent.org-20101218101405-qjbse29shi9coklg
Merge of user identifier work

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
  }
44
44
  null_value= false;
45
45
 
46
 
  std::cerr << "Trying to create " << res->c_str() << "\n";
47
 
 
48
46
  user_locks::Storable *list= static_cast<user_locks::Storable *>(getSession().getProperty("user_locks"));
49
47
  if (list) // To be compatible with MySQL, we will now release all other locks we might have.
50
48
    list->erase_all();
51
49
 
52
50
  bool result;
 
51
  drizzled::identifier::User::const_shared_ptr user_identifier(getSession().user());
53
52
  {
54
53
    boost::this_thread::restore_interruption dl(getSession().getThreadInterupt());
55
54
 
56
55
    try {
57
 
      result= user_locks::Locks::getInstance().lock(getSession().getSessionId(), Key(getSession().getSecurityContext(), res->c_str()), wait_time);
 
56
      result= user_locks::Locks::getInstance().lock(getSession().getSessionId(), Key(*user_identifier, res->c_str()), wait_time);
58
57
    }
59
58
    catch(boost::thread_interrupted const& error)
60
59
    {
65
64
    }
66
65
  }
67
66
 
68
 
  if (boost::indeterminate(result))
69
 
    null_value= true;
70
 
 
71
67
  if (result)
72
68
  {
73
69
    if (not list)
76
72
      getSession().setProperty("user_locks", list);
77
73
    }
78
74
 
79
 
    list->insert(Key(getSession().getSecurityContext(), res->c_str()));
 
75
    list->insert(Key(*user_identifier, res->c_str()));
80
76
 
81
77
    return 1;
82
78
  }