00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022
00023 #include <plugin/user_locks/module.h>
00024
00025 #include <drizzled/atomics.h>
00026 #include <drizzled/session.h>
00027
00028 using namespace drizzled;
00029 using namespace std;
00030
00031 user_locks::UserLocks::UserLocks() :
00032 plugin::TableFunction("DATA_DICTIONARY", "USER_DEFINED_LOCKS")
00033 {
00034 add_field("USER_LOCK_NAME", plugin::TableFunction::STRING, user_locks::LARGEST_LOCK_NAME, false);
00035 add_field("SESSION_ID", plugin::TableFunction::NUMBER, 0, false);
00036 add_field("USERNAME", plugin::TableFunction::STRING);
00037 }
00038
00039 user_locks::UserLocks::Generator::Generator(drizzled::Field **arg) :
00040 drizzled::plugin::TableFunction::Generator(arg)
00041 {
00042 user_locks::Locks::getInstance().Copy(lock_map);
00043 iter= lock_map.begin();
00044 }
00045
00046 bool user_locks::UserLocks::Generator::populate()
00047 {
00048
00049 while (iter != lock_map.end())
00050 {
00051
00052 push(iter->first.getLockName());
00053
00054
00055 push(iter->second->id);
00056
00057
00058 push(iter->first.getUser());
00059
00060 iter++;
00061 return true;
00062 }
00063
00064 return false;
00065 }