~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin.h

  • Committer: Brian Aker
  • Date: 2008-10-15 16:30:14 UTC
  • Revision ID: brian@tangent.org-20081015163014-ua75zeqwk2xe80jh
Firt pass to remove C/C++ funkiness around declaration of THD.

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
 
#ifndef _my_plugin_h
21
 
#define _my_plugin_h
 
20
#ifndef DRIZZLED_PLUGIN_H
 
21
#define DRIZZLED_PLUGIN_H
22
22
 
23
23
#include <drizzled/global.h>
24
24
 
25
 
#ifdef __cplusplus
26
25
class THD;
27
26
class Item;
28
 
#define DRIZZLE_THD THD*
29
 
#else
30
 
#define DRIZZLE_THD void*
31
 
#endif
32
27
 
33
28
#define DRIZZLE_XIDDATASIZE 128
34
29
/**
113
108
 
114
109
 
115
110
#define SHOW_VAR_FUNC_BUFF_SIZE 1024
116
 
typedef int (*mysql_show_var_func)(DRIZZLE_THD, struct st_mysql_show_var*, char *);
 
111
typedef int (*mysql_show_var_func)(THD *, struct st_mysql_show_var *, char *);
117
112
 
118
113
struct st_show_var_func_container {
119
114
  mysql_show_var_func func;
162
157
  automatically at the end of the statement.
163
158
*/
164
159
 
165
 
typedef int (*mysql_var_check_func)(DRIZZLE_THD thd,
 
160
typedef int (*mysql_var_check_func)(THD *thd,
166
161
                                    struct st_mysql_sys_var *var,
167
162
                                    void *save, struct st_mysql_value *value);
168
163
 
180
175
   and persist it in the provided pointer to the dynamic variable.
181
176
   For example, strings may require memory to be allocated.
182
177
*/
183
 
typedef void (*mysql_var_update_func)(DRIZZLE_THD thd,
 
178
typedef void (*mysql_var_update_func)(THD *thd,
184
179
                                      struct st_mysql_sys_var *var,
185
180
                                      void *var_ptr, const void *save);
186
181
 
232
227
} DRIZZLE_SYSVAR_NAME(name)
233
228
 
234
229
#define DECLARE_THDVAR_FUNC(type) \
235
 
  type *(*resolve)(DRIZZLE_THD thd, int offset)
 
230
  type *(*resolve)(THD *thd, int offset)
236
231
 
237
232
#define DECLARE_DRIZZLE_THDVAR_BASIC(name, type) struct { \
238
233
  DRIZZLE_PLUGIN_VAR_HEADER;      \
425
420
extern "C" {
426
421
#endif
427
422
 
428
 
int thd_in_lock_tables(const DRIZZLE_THD thd);
429
 
int thd_tablespace_op(const DRIZZLE_THD thd);
430
 
int64_t thd_test_options(const DRIZZLE_THD thd, int64_t test_options);
431
 
int thd_sql_command(const DRIZZLE_THD thd);
432
 
void **thd_ha_data(const DRIZZLE_THD thd, const struct handlerton *hton);
433
 
int thd_tx_isolation(const DRIZZLE_THD thd);
 
423
int thd_in_lock_tables(const THD *thd);
 
424
int thd_tablespace_op(const THD *thd);
 
425
int64_t thd_test_options(const THD *thd, int64_t test_options);
 
426
int thd_sql_command(const THD *thd);
 
427
void **thd_ha_data(const THD *thd, const struct handlerton *hton);
 
428
int thd_tx_isolation(const THD *thd);
434
429
/* Increments the row counter, see THD::row_count */
435
 
void thd_inc_row_count(DRIZZLE_THD thd);
 
430
void thd_inc_row_count(THD *thd);
436
431
 
437
432
/**
438
433
  Create a temporary file.
462
457
  @retval 0  the connection is active
463
458
  @retval 1  the connection has been killed
464
459
*/
465
 
int thd_killed(const DRIZZLE_THD thd);
 
460
int thd_killed(const THD *thd);
466
461
 
467
462
 
468
463
/**
471
466
  @param thd  user thread connection handle
472
467
  @return  thread id
473
468
*/
474
 
unsigned long thd_get_thread_id(const DRIZZLE_THD thd);
 
469
unsigned long thd_get_thread_id(const THD *thd);
475
470
 
476
471
 
477
472
/**
486
481
 
487
482
  @see alloc_root()
488
483
*/
489
 
void *thd_alloc(DRIZZLE_THD thd, unsigned int size);
490
 
/**
491
 
  @see thd_alloc()
492
 
*/
493
 
void *thd_calloc(DRIZZLE_THD thd, unsigned int size);
494
 
/**
495
 
  @see thd_alloc()
496
 
*/
497
 
char *thd_strdup(DRIZZLE_THD thd, const char *str);
498
 
/**
499
 
  @see thd_alloc()
500
 
*/
501
 
char *thd_strmake(DRIZZLE_THD thd, const char *str, unsigned int size);
502
 
/**
503
 
  @see thd_alloc()
504
 
*/
505
 
void *thd_memdup(DRIZZLE_THD thd, const void* str, unsigned int size);
 
484
void *thd_alloc(THD *thd, unsigned int size);
 
485
/**
 
486
  @see thd_alloc()
 
487
*/
 
488
void *thd_calloc(THD *thd, unsigned int size);
 
489
/**
 
490
  @see thd_alloc()
 
491
*/
 
492
char *thd_strdup(THD *thd, const char *str);
 
493
/**
 
494
  @see thd_alloc()
 
495
*/
 
496
char *thd_strmake(THD *thd, const char *str, unsigned int size);
 
497
/**
 
498
  @see thd_alloc()
 
499
*/
 
500
void *thd_memdup(THD *thd, const void* str, unsigned int size);
506
501
 
507
502
/**
508
503
  Get the XID for this connection's transaction
510
505
  @param thd  user thread connection handle
511
506
  @param xid  location where identifier is stored
512
507
*/
513
 
void thd_get_xid(const DRIZZLE_THD thd, DRIZZLE_XID *xid);
 
508
void thd_get_xid(const THD *thd, DRIZZLE_XID *xid);
514
509
 
515
510
/**
516
511
  Invalidate the query cache for a given table.
520
515
  @param key_length  length of key in bytes, including the NUL bytes
521
516
  @param using_trx   flag: TRUE if using transactions, FALSE otherwise
522
517
*/
523
 
void mysql_query_cache_invalidate4(DRIZZLE_THD thd,
 
518
void mysql_query_cache_invalidate4(THD *thd,
524
519
                                   const char *key, unsigned int key_length,
525
520
                                   int using_trx);
526
521
 
534
529
*/
535
530
inline
536
531
void *
537
 
thd_get_ha_data(const DRIZZLE_THD thd, const struct handlerton *hton)
 
532
thd_get_ha_data(const THD *thd, const struct handlerton *hton)
538
533
{
539
534
  return *thd_ha_data(thd, hton);
540
535
}
544
539
*/
545
540
inline
546
541
void
547
 
thd_set_ha_data(const DRIZZLE_THD thd, const struct handlerton *hton,
 
542
thd_set_ha_data(const THD *thd, const struct handlerton *hton,
548
543
                const void *ha_data)
549
544
{
550
545
  *thd_ha_data(thd, hton)= (void*) ha_data;
551
546
}
552
547
#endif
553
548
 
554
 
#endif
 
549
#endif /* _my_plugin_h */
555
550