[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.118.19.247: ~ $
# This is the DDL function tests for innodb FTS

-- source include/have_innodb.inc

# Create FTS table
CREATE TABLE fts_test (
	id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
	title VARCHAR(200),
	body TEXT
	) ENGINE=InnoDB;

# Insert six rows
INSERT INTO fts_test (title,body) VALUES
	('MySQL Tutorial','DBMS stands for DataBase ...')  ,
	('How To Use MySQL Well','After you went through a ...'),
	('Optimizing MySQL','In this tutorial we will show ...'),
	('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
	('MySQL vs. YourSQL','In the following database comparison ...'),
	('MySQL Security','When configured properly, MySQL ...');

# Create the FTS index
CREATE FULLTEXT INDEX idx on fts_test (title, body);

# Select word "tutorial" in the table
SELECT * FROM fts_test WHERE MATCH (title, body)
        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);


# Drop the FTS idx
DROP INDEX idx ON fts_test;

# Continue insert some rows
INSERT INTO fts_test (title,body) VALUES
	('MySQL Tutorial','DBMS stands for DataBase ...')  ,
	('How To Use MySQL Well','After you went through a ...'),
	('Optimizing MySQL','In this tutorial we will show ...'),
	('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
	('MySQL vs. YourSQL','In the following database comparison ...'),
	('MySQL Security','When configured properly, MySQL ...');


# Recreate the FTS index
CREATE FULLTEXT INDEX idx on fts_test (title, body);

# Select word "tutorial" in the table
SELECT * FROM fts_test WHERE MATCH (title, body)
        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);

# Boolean search
# Select rows contain "MySQL" but not "YourSQL"
SELECT * FROM fts_test WHERE MATCH (title,body)
        AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);

# Truncate table
TRUNCATE TABLE fts_test;

DROP INDEX idx ON fts_test;

# Continue insert some rows
INSERT INTO fts_test (title,body) VALUES
	('MySQL Tutorial','DBMS stands for DataBase ...')  ,
	('How To Use MySQL Well','After you went through a ...'),
	('Optimizing MySQL','In this tutorial we will show ...'),
	('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
	('MySQL vs. YourSQL','In the following database comparison ...'),
	('MySQL Security','When configured properly, MySQL ...');

# Recreate the FTS index
CREATE FULLTEXT INDEX idx on fts_test (title, body);

# Select word "tutorial" in the table
SELECT * FROM fts_test WHERE MATCH (title, body)
        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);

DROP TABLE fts_test;

# Create FTS table
CREATE TABLE fts_test (
	FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
	title VARCHAR(200),
	body TEXT
	) ENGINE=InnoDB;

create unique index FTS_DOC_ID_INDEX on fts_test(FTS_DOC_ID);

# Insert six rows
INSERT INTO fts_test (title,body) VALUES
	('MySQL Tutorial','DBMS stands for DataBase ...')  ,
	('How To Use MySQL Well','After you went through a ...'),
	('Optimizing MySQL','In this tutorial we will show ...'),
	('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
	('MySQL vs. YourSQL','In the following database comparison ...'),
	('MySQL Security','When configured properly, MySQL ...');

# Create the FTS index
# We could support online fulltext index creation when a FTS_DOC_ID
# column already exists. This has not been implemented yet.
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
CREATE FULLTEXT INDEX idx on fts_test (title, body) LOCK=NONE;
CREATE FULLTEXT INDEX idx on fts_test (title, body);

--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, LOCK=NONE;
ALTER TABLE fts_test ROW_FORMAT=REDUNDANT;

SELECT * FROM fts_test WHERE MATCH (title, body)
        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);

# Drop and recreate
drop index idx on fts_test;

CREATE FULLTEXT INDEX idx on fts_test (title, body);

SELECT * FROM fts_test WHERE MATCH (title, body)
        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);

# Drop the FTS_DOC_ID_INDEX and try again
drop index idx on fts_test;

drop index FTS_DOC_ID_INDEX on fts_test;

CREATE FULLTEXT INDEX idx on fts_test (title, body);

SELECT * FROM fts_test WHERE MATCH (title, body)
        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);

drop table fts_test;

# Test FTS_DOC_ID and FTS_DOC_ID_INDEX all in the create table clause
CREATE TABLE fts_test (
   FTS_DOC_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
   title varchar(255) NOT NULL DEFAULT '',
   text mediumtext NOT NULL,
   PRIMARY KEY (FTS_DOC_ID),
   UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
   FULLTEXT KEY idx (title,text)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

set @@auto_increment_increment=10;

INSERT INTO fts_test (title, text) VALUES
        ('MySQL Tutorial','DBMS stands for DataBase ...'),
        ('How To Use MySQL Well','After you went through a ...'),
        ('Optimizing MySQL','In this tutorial we will show ...'),
        ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
        ('MySQL vs. YourSQL','In the following database comparison ...'),
        ('MySQL Security','When configured properly, MySQL ...');
-- disable_result_log
ANALYZE TABLE fts_test;
-- enable_result_log
set @@auto_increment_increment=1;

select *, match(title, text)  AGAINST ('database') as score
from fts_test order by score desc;

drop index idx on fts_test;

drop table fts_test;

# This should fail:
# Create a FTS_DOC_ID of the wrong type (should be bigint)
--error 1166
CREATE TABLE fts_test (
   FTS_DOC_ID int(20) unsigned NOT NULL AUTO_INCREMENT,
   title varchar(255) NOT NULL DEFAULT '',
   text mediumtext NOT NULL,
   PRIMARY KEY (FTS_DOC_ID),
   UNIQUE KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
   FULLTEXT KEY idx (title,text)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

# This should fail:
# Create a FTS_DOC_ID_INDEX of the wrong type (should be unique)
--error ER_INNODB_FT_WRONG_DOCID_INDEX
CREATE TABLE fts_test (
   FTS_DOC_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT,
   title varchar(255) NOT NULL DEFAULT '',
   text mediumtext NOT NULL,
   PRIMARY KEY (FTS_DOC_ID),
   KEY FTS_DOC_ID_INDEX (FTS_DOC_ID),
   FULLTEXT KEY idx (title,text)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

CREATE TABLE articles (
	FTS_DOC_ID BIGINT UNSIGNED NOT NULL ,
	title VARCHAR(200),
	body TEXT
) ENGINE=InnoDB;

INSERT INTO articles (FTS_DOC_ID, title, body) VALUES
        (9, 'MySQL Tutorial','DBMS stands for DataBase ...'),
        (10, 'How To Use MySQL Well','After you went through a ...'),
        (12, 'Optimizing MySQL','In this tutorial we will show ...'),
        (14,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
        (19, 'MySQL vs. YourSQL','In the following database comparison ...'),
        (20, 'MySQL Security','When configured properly, MySQL ...');

--error ER_INNODB_FT_LIMIT
ALTER TABLE articles ADD FULLTEXT INDEX idx3 (title),
		     ADD FULLTEXT INDEX idx5 (title);

CREATE FULLTEXT INDEX idx on articles (title);
ALTER TABLE articles ADD FULLTEXT INDEX idx3 (title);

ALTER TABLE articles ADD INDEX t20 (title(20)), LOCK=NONE;
ALTER TABLE articles DROP INDEX t20;

INSERT INTO articles (FTS_DOC_ID, title, body) VALUES
        (29, 'MySQL Tutorial','DBMS stands for DataBase ...'),
        (30, 'How To Use MySQL Well','After you went through a ...'),
        (32, 'Optimizing MySQL','In this tutorial we will show ...'),
        (34,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
        (39, 'MySQL vs. YourSQL','In the following database comparison ...'),
        (40, 'MySQL Security','When configured properly, MySQL ...');

SELECT * FROM articles WHERE MATCH (title)
        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);

DROP INDEX idx ON articles;

SELECT * FROM articles WHERE MATCH (title)
        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);

CREATE FULLTEXT INDEX idx on articles (title, body);

SELECT * FROM articles WHERE MATCH (title, body)
        AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);

DROP TABLE articles;

create table articles(`FTS_DOC_ID` serial,
`col32` timestamp not null,`col115` text) engine=innodb;

create fulltext index `idx5` on articles(`col115`)  ;

alter ignore table articles add primary key  (`col32`)  ;

drop table articles;

# Create a table with FTS index, this will create hidden column FTS_DOC_ID
CREATE TABLE articles (
	id INT UNSIGNED NOT NULL,
	title VARCHAR(200),
	body TEXT
	) ENGINE=InnoDB;

INSERT INTO articles VALUES
	(1, 'MySQL Tutorial','DBMS stands for DataBase ...')  ,
	(2, 'How To Use MySQL Well','After you went through a ...'),
	(3, 'Optimizing MySQL','In this tutorial we will show ...'),
	(4, '1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
	(5, 'MySQL vs. YourSQL','In the following database comparison ...'),
	(6, 'MySQL Security','When configured properly, MySQL ...');

CREATE FULLTEXT INDEX idx on articles (title, body);

# Drop the FTS index, however, this will keep the FTS_DOC_ID hidden
# column (to avoid a table rebuild)
DROP INDEX idx ON articles;

# Now create cluster index on id online; The rebuild should still
# have the FTS_DOC_ID
CREATE UNIQUE INDEX idx2 ON articles(id);

# Recreate FTS index, this should not require a rebuild,
# since the FTS_DOC_ID is still there
CREATE FULLTEXT INDEX idx on articles (title, body);

SELECT * FROM articles WHERE MATCH (title, body)
	AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);

DROP TABLE articles;

Filemanager

Name Type Size Permission Actions
disabled.def File 404 B 0644
fts_compatibility.test File 9.74 KB 0644
fts_compatibility_win.test File 9.58 KB 0644
fulltext.test File 22.1 KB 0644
fulltext2.test File 8.27 KB 0644
fulltext3.test File 988 B 0644
fulltext_cache.test File 1.55 KB 0644
fulltext_distinct.test File 1.18 KB 0644
fulltext_left_join.test File 4.54 KB 0644
fulltext_misc.test File 7.75 KB 0644
fulltext_multi.test File 919 B 0644
fulltext_order_by.test File 5.57 KB 0644
fulltext_plugin-master.opt File 19 B 0644
fulltext_update.test File 1.02 KB 0644
fulltext_var.test File 1.36 KB 0644
innobase_drop_fts_index_table.test File 407 B 0644
innodb-fts-basic.test File 8.74 KB 0644
innodb-fts-ddl.test File 9.15 KB 0644
innodb-fts-fic.test File 7.12 KB 0644
innodb-fts-stopword.test File 30.48 KB 0644
innodb_fts_index_table.test File 3.32 KB 0644
innodb_fts_large_records.test File 12.15 KB 0644
innodb_fts_misc.test File 55.24 KB 0644
innodb_fts_misc_1.test File 33.01 KB 0644
innodb_fts_misc_debug.test File 6.81 KB 0644
innodb_fts_multiple_index.test File 6.34 KB 0644
innodb_fts_opt.test File 14.02 KB 0644
innodb_fts_plugin.test File 1.35 KB 0644
innodb_fts_proximity.test File 7.98 KB 0644
innodb_fts_result_cache_limit.test File 1.76 KB 0644
innodb_fts_savepoint.test File 9.09 KB 0644
innodb_fts_stopword_charset.test File 13.79 KB 0644
innodb_fts_transaction.test File 31.11 KB 0644
phrase.test File 1.01 KB 0644
subexpr.test File 2.09 KB 0644
sync.test File 5.33 KB 0644
sync_block.test File 3.48 KB 0644