/[eiffelstudio]/branches/eth/eve/Src/library/abel/libraries/ethz/src/abel/backends/generic_database_layout/ps_mysql_strings.e
ViewVC logotype

Contents of /branches/eth/eve/Src/library/abel/libraries/ethz/src/abel/backends/generic_database_layout/ps_mysql_strings.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 88969 - (show annotations)
Fri Jun 22 11:53:00 2012 UTC (7 years, 3 months ago) by romanschmocker
File size: 2169 byte(s)
Changed structure in the ABEL library repository - e.g. pre-built backends are now collected in their own cluster
1 note
2 description: "The MySQL specific SQL statements for the generic layout mapping strategy."
3 author: "Roman Schmocker"
4 date: "$Date$"
5 revision: "$Revision$"
6
7 class
8 PS_MYSQL_STRINGS
9
10 inherit
11 PS_GENERIC_LAYOUT_SQL_STRINGS
12
13
14 feature {PS_GENERIC_LAYOUT_KEY_MANAGER} -- Table creation
15
16
17 Create_value_table: STRING
18 do
19 Result:= "[
20 CREATE TABLE ps_value (
21 objectid INTEGER NOT NULL AUTO_INCREMENT,
22 attributeid INTEGER,
23 runtimetype INTEGER,
24 value VARCHAR(128),
25
26 PRIMARY KEY (objectid, attributeid),
27 FOREIGN KEY (attributeid) REFERENCES ps_attribute (attributeid) ON DELETE CASCADE,
28 FOREIGN KEY (runtimetype) REFERENCES ps_class (classid) ON DELETE CASCADE
29 )
30 ]"
31 end
32
33
34 Create_class_table: STRING
35 do
36 Result:= "[
37
38 CREATE TABLE ps_class (
39 classid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
40 classname VARCHAR(64)
41 )
42 ]"
43 end
44
45 Create_attribute_table: STRING
46 do
47 Result:= "[
48 CREATE TABLE ps_attribute (
49 attributeid INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
50 name VARCHAR(128),
51 class INTEGER,
52
53 FOREIGN KEY (class) REFERENCES ps_class (classid) ON DELETE CASCADE
54 )
55 ]"
56 end
57
58 feature {PS_GENERIC_LAYOUT_KEY_MANAGER} -- Data querying - Key manager
59
60 Show_tables: STRING
61 do
62 Result:= "SHOW TABLES"
63 end
64
65
66
67 feature {PS_GENERIC_LAYOUT_KEY_MANAGER} -- Data modification - Key manager
68
69 Insert_class_use_autoincrement (class_name:STRING):STRING
70 do
71 Result:="INSERT INTO ps_class (classname) VALUES ('" + class_name + "')"
72 end
73
74 Insert_attribute_use_autoincrement (attribute_name:STRING; class_key:INTEGER):STRING
75 do
76 Result:= "INSERT INTO ps_attribute (name, class) VALUES ('" + attribute_name + "', " + class_key.out + ")"
77 end
78
79
80 feature {PS_GENERIC_LAYOUT_SQL_BACKEND} -- Data modification - Backend
81
82 Insert_value_use_autoincrement (attribute_id, runtimetype:INTEGER; value: STRING): STRING
83 do
84 Result:= "INSERT INTO ps_value (attributeid, runtimetype, value) VALUES (" + attribute_id.out + ", " + runtimetype.out + ", '" + value + "')"
85 end
86
87
88 feature {PS_GENERIC_LAYOUT_SQL_BACKEND}
89
90 For_update_appendix: STRING = " FOR UPDATE "
91
92
93 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23