~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/query_id.cc

  • Committer: Jay Pipes
  • Date: 2009-02-21 16:00:06 UTC
  • mto: (907.1.1 trunk-with-temporal)
  • mto: This revision was merged to the branch mainline in revision 908.
  • Revision ID: jpipes@serialcoder-20090221160006-vnk3wt4qbcz62eru
Removes the TIME column type and related time functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
 
20
#include <drizzled/global.h>
21
21
#include <drizzled/definitions.h>
22
22
#include <drizzled/query_id.h>
23
 
#include "drizzled/internal/my_pthread.h"
24
 
 
25
 
namespace drizzled
26
 
{
27
 
 
28
 
Query_id::Query_id()
29
 
{
30
 
  the_query_id= 1;
 
23
#include <mysys/my_pthread.h>
 
24
 
 
25
Query_id::Query_id() : the_query_id(1)
 
26
{
 
27
  /* pthread_mutex_init always returns 0 */
 
28
  (void)pthread_mutex_init(&LOCK_query_id, MY_MUTEX_INIT_FAST);
31
29
}
32
30
 
33
31
Query_id::~Query_id()
34
32
{
 
33
  pthread_mutex_destroy(&LOCK_query_id);
35
34
}
36
35
 
37
 
uint64_t Query_id::value() const
 
36
query_id_t Query_id::value() const
38
37
{
39
38
  return the_query_id;
40
39
}
41
40
 
42
 
uint64_t Query_id::next()
 
41
query_id_t Query_id::next()
43
42
{
44
 
  uint64_t ret= the_query_id.increment();
 
43
  pthread_mutex_lock(&LOCK_query_id);
 
44
  query_id_t ret= the_query_id++;
 
45
  pthread_mutex_unlock(&LOCK_query_id);
45
46
 
46
47
  return ret;
47
48
}
48
49
 
49
 
} /* namespace drizzled */