blob: 9082032ff6e9e51902dae8a0b58692120189353d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
DROP TABLE IF EXISTS diaries;
CREATE TABLE diaries (
id INT PRIMARY KEY AUTO_INCREMENT,
title TEXT,
body TEXT,
FULLTEXT INDEX title_index (title),
FULLTEXT INDEX body_index (body)
) COMMENT = 'ENGINE "InnoDB"' DEFAULT CHARSET UTF8;
INSERT INTO diaries (title, body) VALUES ("survey", "will start groonga!");
INSERT INTO diaries (title, body) VALUES ("groonga (1)", "starting groonga...");
INSERT INTO diaries (title, body) VALUES ("groonga (2)", "started groonga.");
SELECT * FROM diaries
WHERE MATCH(title) AGAINST("survey") AND
MATCH(body) AGAINST("groonga");
id title body
1 survey will start groonga!
START TRANSACTION;
DELETE FROM diaries WHERE id = 1;
ROLLBACK;
SELECT * FROM diaries;
id title body
1 survey will start groonga!
2 groonga (1) starting groonga...
3 groonga (2) started groonga.
SELECT * FROM diaries
WHERE MATCH(title) AGAINST("survey") AND
MATCH(body) AGAINST("groonga");
id title body
DELETE FROM diaries WHERE id = 1;
Warnings:
Warning 1026 failed to get record ID for deleting from groonga: key=<>
SELECT * FROM diaries;
id title body
2 groonga (1) starting groonga...
3 groonga (2) started groonga.
SELECT * FROM diaries
WHERE MATCH(title) AGAINST("survey") AND
MATCH(body) AGAINST("groonga");
id title body
DROP TABLE diaries;
|