Skip to content

Commit 3eafcbc

Browse files
Merge [email protected]:/home/bk/mysql-5.1-new
into mysql.com:/Users/kent/mysql/bk/mysql-5.1-new
2 parents 31bb67f + eed744d commit 3eafcbc

32 files changed

+605
-234
lines changed

include/ft_global.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ extern ulong ft_min_word_len;
5353
extern ulong ft_max_word_len;
5454
extern ulong ft_query_expansion_limit;
5555
extern char ft_boolean_syntax[15];
56+
extern struct st_mysql_ftparser ft_default_parser;
5657

5758
int ft_init_stopwords(void);
5859
void ft_free_stopwords(void);

include/my_global.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,4 +1380,13 @@ do { doubleget_union _tmp; \
13801380
#define dlerror() ""
13811381
#endif
13821382

1383+
/* FreeBSD 2.2.2 does not define RTLD_NOW) */
1384+
#ifndef RTLD_NOW
1385+
#define RTLD_NOW 1
1386+
#endif
1387+
1388+
#ifndef HAVE_DLERROR
1389+
#define dlerror() ""
1390+
#endif
1391+
13831392
#endif /* my_global_h */

include/myisam.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ extern "C" {
3232
#include "keycache.h"
3333
#endif
3434
#include "my_handler.h"
35+
#include <plugin.h>
3536

3637
/* defines used by myisam-funktions */
3738

@@ -196,6 +197,7 @@ typedef struct st_mi_keydef /* Key definition with open & info */
196197
uint32 version; /* For concurrent read/write */
197198

198199
HA_KEYSEG *seg,*end;
200+
struct st_mysql_ftparser *parser; /* Fulltext [pre]parser */
199201
int (*bin_search)(struct st_myisam_info *info,struct st_mi_keydef *keyinfo,
200202
uchar *page,uchar *key,
201203
uint key_len,uint comp_flag,uchar * *ret_pos,

libmysqld/Makefile.am

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@
2020
MYSQLDATAdir = $(localstatedir)
2121
MYSQLSHAREdir = $(pkgdatadir)
2222
MYSQLBASEdir= $(prefix)
23+
MYSQLLIBdir= $(libdir)
2324

2425
DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
2526
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
2627
-DDATADIR="\"$(MYSQLDATAdir)\"" \
27-
-DSHAREDIR="\"$(MYSQLSHAREdir)\""
28+
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
29+
-DLIBDIR="\"$(MYSQLLIBdir)\""
2830
INCLUDES= @bdb_includes@ \
2931
-I$(top_builddir)/include -I$(top_srcdir)/include \
3032
-I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples \

mysql-test/r/connect.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ help_keyword
99
help_relation
1010
help_topic
1111
host
12+
plugin
1213
proc
1314
procs_priv
1415
tables_priv
@@ -36,6 +37,7 @@ help_keyword
3637
help_relation
3738
help_topic
3839
host
40+
plugin
3941
proc
4042
procs_priv
4143
tables_priv
@@ -71,6 +73,7 @@ help_keyword
7173
help_relation
7274
help_topic
7375
host
76+
plugin
7477
proc
7578
procs_priv
7679
tables_priv

mysql-test/r/information_schema.result

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ help_keyword
6060
help_relation
6161
help_topic
6262
host
63+
plugin
6364
proc
6465
procs_priv
6566
tables_priv
@@ -709,7 +710,7 @@ CREATE TABLE t_crashme ( f1 BIGINT);
709710
CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;
710711
CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;
711712
count(*)
712-
101
713+
102
713714
drop view a2, a1;
714715
drop table t_crashme;
715716
select table_schema,table_name, column_name from
@@ -779,7 +780,7 @@ flush privileges;
779780
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
780781
table_schema count(*)
781782
information_schema 16
782-
mysql 17
783+
mysql 18
783784
create table t1 (i int, j int);
784785
create trigger trg1 before insert on t1 for each row
785786
begin

mysql-test/r/mysqlcheck.result

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ mysql.help_keyword OK
66
mysql.help_relation OK
77
mysql.help_topic OK
88
mysql.host OK
9+
mysql.plugin OK
910
mysql.proc OK
1011
mysql.procs_priv OK
1112
mysql.tables_priv OK
@@ -23,6 +24,7 @@ mysql.help_keyword OK
2324
mysql.help_relation OK
2425
mysql.help_topic OK
2526
mysql.host OK
27+
mysql.plugin OK
2628
mysql.proc OK
2729
mysql.procs_priv OK
2830
mysql.tables_priv OK

mysql-test/r/system_mysql_db.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ help_keyword
99
help_relation
1010
help_topic
1111
host
12+
plugin
1213
proc
1314
procs_priv
1415
tables_priv

mysql-test/t/system_mysql_db_fix.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','
8585

8686
-- disable_query_log
8787

88-
DROP TABLE db, host, user, func, tables_priv, columns_priv, procs_priv, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type;
88+
DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type;
8989

9090
-- enable_query_log
9191

scripts/mysql_create_system_tables.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ c_hc=""
3939
c_hr=""
4040
c_hk=""
4141
i_ht=""
42-
c_tzn="" c_tz="" c_tzt="" c_tztt="" c_tzls=""
43-
i_tzn="" i_tz="" i_tzt="" i_tztt="" i_tzls=""
42+
c_tzn="" c_tz="" c_tzt="" c_tztt="" c_tzls="" c_pl=""
43+
i_tzn="" i_tz="" i_tzt="" i_tztt="" i_tzls="" i_pl=""
4444
c_p="" c_pp=""
4545

4646
# Check for old tables
@@ -202,6 +202,21 @@ then
202202
c_f="$c_f comment='User defined functions';"
203203
fi
204204

205+
if test ! -f $mdata/plugin.frm
206+
then
207+
if test "$1" = "verbose" ; then
208+
echo "Preparing plugin table" 1>&2;
209+
fi
210+
211+
c_pl="$c_pl CREATE TABLE plugin ("
212+
c_pl="$c_pl name char(64) binary DEFAULT '' NOT NULL,"
213+
c_pl="$c_pl dl char(128) DEFAULT '' NOT NULL,"
214+
c_pl="$c_pl PRIMARY KEY (name)"
215+
c_pl="$c_pl ) engine=MyISAM"
216+
c_pl="$c_pl CHARACTER SET utf8 COLLATE utf8_bin"
217+
c_pl="$c_pl comment='MySQL plugins';"
218+
fi
219+
205220
if test ! -f $mdata/tables_priv.frm
206221
then
207222
if test "$1" = "verbose" ; then
@@ -741,6 +756,9 @@ $i_u
741756
$c_f
742757
$i_f
743758
759+
$c_pl
760+
$i_pl
761+
744762
$c_t
745763
$c_c
746764

scripts/mysql_fix_privilege_tables.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ CREATE TABLE IF NOT EXISTS func (
1919
PRIMARY KEY (name)
2020
) CHARACTER SET utf8 COLLATE utf8_bin;
2121

22+
CREATE TABLE IF NOT EXISTS plugin (
23+
name char(64) binary DEFAULT '' NOT NULL,
24+
dl char(128) DEFAULT '' NOT NULL,
25+
PRIMARY KEY (name)
26+
) CHARACTER SET utf8 COLLATE utf8_bin;
27+
2228
ALTER TABLE user add File_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
2329

2430
-- Detect whether or not we had the Grant_priv column

sql/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
MYSQLDATAdir = $(localstatedir)
2020
MYSQLSHAREdir = $(pkgdatadir)
2121
MYSQLBASEdir= $(prefix)
22+
MYSQLLIBdir= $(pkglibdir)
2223
INCLUDES = @ZLIB_INCLUDES@ \
2324
@bdb_includes@ @innodb_includes@ @ndbcluster_includes@ \
2425
-I$(top_builddir)/include -I$(top_srcdir)/include \
@@ -116,6 +117,7 @@ DEFS = -DMYSQL_SERVER \
116117
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
117118
-DDATADIR="\"$(MYSQLDATAdir)\"" \
118119
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
120+
-DLIBDIR="\"$(MYSQLLIBdir)\"" \
119121
@DEFS@
120122

121123
BUILT_SOURCES = sql_yacc.cc sql_yacc.h lex_hash.h

sql/ha_myisam.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ int ha_myisam::dump(THD* thd, int fd)
280280

281281
int ha_myisam::open(const char *name, int mode, uint test_if_locked)
282282
{
283+
uint i;
283284
if (!(file=mi_open(name, mode, test_if_locked)))
284285
return (my_errno ? my_errno : -1);
285286

@@ -292,6 +293,14 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked)
292293
int_table_flags|=HA_REC_NOT_IN_SEQ;
293294
if (file->s->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))
294295
int_table_flags|=HA_HAS_CHECKSUM;
296+
297+
for (i= 0; i < table->s->keys; i++)
298+
{
299+
struct st_plugin_int *parser= table->key_info[i].parser;
300+
if (table->key_info[i].flags & HA_USES_PARSER)
301+
file->s->keyinfo[i].parser=
302+
(struct st_mysql_ftparser *)parser->plugin->info;
303+
}
295304
return (0);
296305
}
297306

sql/lex.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ static SYMBOL symbols[] = {
246246
{ "INSENSITIVE", SYM(INSENSITIVE_SYM)},
247247
{ "INSERT", SYM(INSERT)},
248248
{ "INSERT_METHOD", SYM(INSERT_METHOD)},
249+
{ "INSTALL", SYM(INSTALL_SYM)},
249250
{ "INT", SYM(INT_SYM)},
250251
{ "INT1", SYM(TINYINT)},
251252
{ "INT2", SYM(SMALLINT)},
@@ -370,13 +371,15 @@ static SYMBOL symbols[] = {
370371
{ "OUTER", SYM(OUTER)},
371372
{ "OUTFILE", SYM(OUTFILE)},
372373
{ "PACK_KEYS", SYM(PACK_KEYS_SYM)},
374+
{ "PARSER", SYM(PARSER_SYM)},
373375
{ "PARTIAL", SYM(PARTIAL)},
374376
#ifdef HAVE_PARTITION_DB
375377
{ "PARTITION", SYM(PARTITION_SYM)},
376378
#endif
377379
{ "PARTITIONS", SYM(PARTITIONS_SYM)},
378380
{ "PASSWORD", SYM(PASSWORD)},
379381
{ "PHASE", SYM(PHASE_SYM)},
382+
{ "PLUGIN", SYM(PLUGIN_SYM)},
380383
{ "POINT", SYM(POINT_SYM)},
381384
{ "POLYGON", SYM(POLYGON)},
382385
{ "PRECISION", SYM(PRECISION)},
@@ -454,7 +457,7 @@ static SYMBOL symbols[] = {
454457
{ "SNAPSHOT", SYM(SNAPSHOT_SYM)},
455458
{ "SMALLINT", SYM(SMALLINT)},
456459
{ "SOME", SYM(ANY_SYM)},
457-
{ "SONAME", SYM(UDF_SONAME_SYM)},
460+
{ "SONAME", SYM(SONAME_SYM)},
458461
{ "SOUNDS", SYM(SOUNDS_SYM)},
459462
{ "SPATIAL", SYM(SPATIAL_SYM)},
460463
{ "SPECIFIC", SYM(SPECIFIC_SYM)},
@@ -525,6 +528,7 @@ static SYMBOL symbols[] = {
525528
{ "UNIQUE", SYM(UNIQUE_SYM)},
526529
{ "UNKNOWN", SYM(UNKNOWN_SYM)},
527530
{ "UNLOCK", SYM(UNLOCK_SYM)},
531+
{ "UNINSTALL", SYM(UNINSTALL_SYM)},
528532
{ "UNSIGNED", SYM(UNSIGNED)},
529533
{ "UNTIL", SYM(UNTIL_SYM)},
530534
{ "UPDATE", SYM(UPDATE_SYM)},

sql/mysqld.cc

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,10 +1072,13 @@ void clean_up(bool print_message)
10721072
lex_free(); /* Free some memory */
10731073
set_var_free();
10741074
free_charsets();
1075-
#ifdef HAVE_DLOPEN
10761075
if (!opt_noacl)
1076+
{
1077+
#ifdef HAVE_DLOPEN
10771078
udf_free();
10781079
#endif
1080+
plugin_free();
1081+
}
10791082
(void) ha_panic(HA_PANIC_CLOSE); /* close all tables and logs */
10801083
if (tc_log)
10811084
tc_log->close();
@@ -3413,10 +3416,13 @@ we force server id to 2, but this MySQL server will not act as a slave.");
34133416
if (!opt_noacl)
34143417
(void) grant_init();
34153418

3416-
#ifdef HAVE_DLOPEN
34173419
if (!opt_noacl)
3420+
{
3421+
plugin_init();
3422+
#ifdef HAVE_DLOPEN
34183423
udf_init();
34193424
#endif
3425+
}
34203426
if (opt_bootstrap) /* If running with bootstrap, do not start replication. */
34213427
opt_skip_slave_start= 1;
34223428
/*
@@ -4574,7 +4580,8 @@ enum options_mysqld
45744580
OPT_TIMED_MUTEXES,
45754581
OPT_OLD_STYLE_USER_LIMITS,
45764582
OPT_LOG_SLOW_ADMIN_STATEMENTS,
4577-
OPT_TABLE_LOCK_WAIT_TIMEOUT
4583+
OPT_TABLE_LOCK_WAIT_TIMEOUT,
4584+
OPT_PLUGIN_DIR
45784585
};
45794586

45804587

@@ -5724,6 +5731,10 @@ The minimum value for this variable is 4096.",
57245731
(gptr*) &global_system_variables.optimizer_search_depth,
57255732
(gptr*) &max_system_variables.optimizer_search_depth,
57265733
0, GET_ULONG, OPT_ARG, MAX_TABLES+1, 0, MAX_TABLES+2, 0, 1, 0},
5734+
{"plugin_dir", OPT_PLUGIN_DIR,
5735+
"Directory for plugins.",
5736+
(gptr*) &opt_plugin_dir_ptr, (gptr*) &opt_plugin_dir_ptr, 0,
5737+
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
57275738
{"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE,
57285739
"The size of the buffer that is allocated when preloading indexes",
57295740
(gptr*) &global_system_variables.preload_buff_size,
@@ -7215,6 +7226,10 @@ static void fix_paths(void)
72157226
(void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir
72167227
(void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home);
72177228
(void) my_load_path(pidfile_name,pidfile_name,mysql_real_data_home);
7229+
strmake(opt_plugin_dir, get_relative_path(LIBDIR),
7230+
sizeof(opt_plugin_dir) - 1);
7231+
opt_plugin_dir_ptr= opt_plugin_dir;
7232+
(void) my_load_path(opt_plugin_dir, opt_plugin_dir_ptr, mysql_home);
72187233

72197234
char *sharedir=get_relative_path(SHAREDIR);
72207235
if (test_if_hard_path(sharedir))

sql/set_var.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,7 @@ struct show_var_st init_vars[]= {
781781
{sys_optimizer_search_depth.name,(char*) &sys_optimizer_search_depth,
782782
SHOW_SYS},
783783
{"pid_file", (char*) pidfile_name, SHOW_CHAR},
784+
{"plugin_dir", (char*) opt_plugin_dir, SHOW_CHAR},
784785
{"port", (char*) &mysqld_port, SHOW_INT},
785786
{sys_preload_buff_size.name, (char*) &sys_preload_buff_size, SHOW_SYS},
786787
{"protocol_version", (char*) &protocol_version, SHOW_INT},

sql/share/errmsg.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3006,7 +3006,7 @@ ER_CANT_FIND_DL_ENTRY
30063006
cze "Nemohu naj-B�t funkci '%-.64s' v knihovn�'"
30073007
dan "Kan ikke finde funktionen '%-.64s' i bibliotek'"
30083008
nla "Kan functie '%-.64s' niet in library vinden"
3009-
eng "Can't find function '%-.64s' in library'"
3009+
eng "Can't find symbol '%-.64s' in library'"
30103010
jps "function '%-.64s' �����C�u�����[���Ɍ��t���鎖���ł��܂���",
30113011
est "Ei leia funktsiooni '%-.64s' antud teegis"
30123012
fre "Impossible de trouver la fonction '%-.64s' dans la biblioth�que'"
@@ -3018,7 +3018,7 @@ ER_CANT_FIND_DL_ENTRY
30183018
kor "���̹��������� '%-.64s' �Լ��� ã�� �� �����ϴ�."
30193019
por "N�o pode encontrar a fun��o '%-.64s' na biblioteca"
30203020
rum "Nu pot gasi functia '%-.64s' in libraria"
3021-
rus "���������� �������� ������ '%-.64s' � ����������"
3021+
rus "���������� �������� ������ '%-.64s' � ����������"
30223022
serbian "Ne mogu da pronadjem funkciju '%-.64s' u biblioteci"
30233023
slo "Nem��em n�js� funkciu '%-.64s' v kni�nici'"
30243024
spa "No puedo encontrar funci�n '%-.64s' en libraria'"

sql/sql_class.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,13 @@ class Key :public Sql_alloc {
413413
List<key_part_spec> columns;
414414
const char *name;
415415
bool generated;
416+
LEX_STRING *parser_name;
416417

417418
Key(enum Keytype type_par, const char *name_arg, enum ha_key_alg alg_par,
418-
bool generated_arg, List<key_part_spec> &cols)
419+
bool generated_arg, List<key_part_spec> &cols,
420+
LEX_STRING *parser_arg= 0)
419421
:type(type_par), algorithm(alg_par), columns(cols), name(name_arg),
420-
generated(generated_arg)
422+
generated(generated_arg), parser_name(parser_arg)
421423
{}
422424
~Key() {}
423425
/* Equality comparison of keys (ignoring name) */

sql/sql_lex.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ enum enum_sql_command {
9191
SQLCOM_CREATE_TRIGGER, SQLCOM_DROP_TRIGGER,
9292
SQLCOM_XA_START, SQLCOM_XA_END, SQLCOM_XA_PREPARE,
9393
SQLCOM_XA_COMMIT, SQLCOM_XA_ROLLBACK, SQLCOM_XA_RECOVER,
94+
SQLCOM_INSTALL_PLUGIN, SQLCOM_UNINSTALL_PLUGIN,
9495
/* This should be the last !!! */
9596

9697
SQLCOM_END

sql/sql_parse.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4780,6 +4780,15 @@ mysql_execute_command(THD *thd)
47804780
case SQLCOM_XA_RECOVER:
47814781
res= mysql_xa_recover(thd);
47824782
break;
4783+
case SQLCOM_INSTALL_PLUGIN:
4784+
if (! (res= mysql_install_plugin(thd, &thd->lex->comment,
4785+
&thd->lex->ident)))
4786+
send_ok(thd);
4787+
break;
4788+
case SQLCOM_UNINSTALL_PLUGIN:
4789+
if (! (res= mysql_uninstall_plugin(thd, &thd->lex->comment)))
4790+
send_ok(thd);
4791+
break;
47834792
default:
47844793
DBUG_ASSERT(0); /* Impossible */
47854794
send_ok(thd);

0 commit comments

Comments
 (0)