~drizzle-trunk/drizzle/development

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Copyright (C) 2008-2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
# USA

query:
	create_table | drop_table |
	create_procedure | drop_procedure | call_procedure | call_procedure | call_procedure | call_procedure |
	create_trigger | drop_trigger ;

create_table:
	CREATE TABLE IF NOT EXISTS table_name (
		`pk` INTEGER NOT NULL AUTO_INCREMENT ,
		`col_int` INTEGER ,
		PRIMARY KEY ( `pk` )
	) partition SELECT `pk` , `col_int_key` FROM source_table ;

drop_table:
	DROP TABLE IF EXISTS table_name ;

create_view:
	CREATE OR REPLACE VIEW view_name AS SELECT * FROM table_name ;

create_procedure:
	CREATE PROCEDURE procedure_name () BEGIN proc_query ; proc_query ; proc_query ; proc_query ; END ;

drop_procedure:
	DROP PROCEDURE IF EXISTS procedure_name ;

create_trigger:
	CREATE TRIGGER trigger_name trigger_time trigger_event ON table_name FOR EACH ROW BEGIN trigger_body ; END ;

drop_trigger:
	DROP TRIGGER trigger_name ;

trigger_name:
	letter ;

trigger_time:
	BEFORE | AFTER ;

trigger_event:
	INSERT | UPDATE ;

trigger_body:
	call_procedure | insert | update ;

proc_query:
	select | insert | update ;

select:
	SELECT * FROM table_or_view_name ;

insert:
	INSERT INTO table_or_view_name ( `col_int` ) VALUES ( digit ) , ( digit ) , ( digit ) ;

update:
	UPDATE table_or_view_name SET field_name = digit WHERE field_name = digit ;

call_procedure:
	CALL procedure_name ;

partition:
	PARTITION BY partition_hash_or_key;

partition_hash_or_key:
	HASH ( field_name ) partitions |
	KEY ( field_name ) partitions ;

partitions:
	PARTITIONS digit ;

procedure_name:
	letter ;

table_or_view_name:
	table_name | view_name ;

table_name:
	t1 | t2 | t3 | t4 | t5 | t6 | t7 | t8 | t9 | t10 ;

view_name:
	letter;

field_name:
	`pk` | `col_int` ;

source_table:
	D | E ;