Commit a66ad216efcbfe28e4f095ffc68d29e2b8f08412

Authored by David RENÉ
1 parent e701df09

remove unneeded comment and sources

Showing 1 changed file with 0 additions and 148 deletions   Show diff stats
database/model/db_model.anubis
... ... @@ -6,19 +6,7 @@
6 6 * © David RENÉ
7 7 */
8 8  
9   - The HayamiKi (早見木) project
10 9  
11   - Interfacing, generating and controling a database with Anubis
12   -
13   -
14   - Author: David René
15   -
16   -
17   - In order to generate such tools, DB_Model needs a formal
18   - description of the database.
19   -
20   -
21   -
22 10 *** (1.2) 'MaybeNull'.
23 11  
24 12 This type scheme is isomorphic to 'Maybe', and is used for representing data which
... ... @@ -33,69 +21,7 @@ public type MaybeNull($T):
33 21  
34 22 Conversion tools between date, time and datetime in ISO-8601 format and 'Int'
35 23 (number of seconds since the epoch) are provided in 'library/tools/ISO-8601.anubis'.
36   -
37   -
38   - *** (1.3) 'HK_Model_Attr' (attributes of columns).
39   -
40   - Possible attributes of columns: (each column has a list of such attributes)
41   -
42   -
43   -
44   -
45   -
46   -
47   -
48   -
49   - Of course, 'NOT NULL' is not an alternative of 'HK_Model_Attr' because it is already coded into the
50   - database type itself (type 'HK_Model_Field' above).
51   -
52   -
53   -
54   -
55   -
56   - *** (3.7) 'DB_Model_Table' (describing a table).
57   -
58   - Description of a table:
59   -
60   -
61   -
62   -
63   -
64   -
65   -
66   -
67 24  
68   - Description of a whole database:
69   -
70   -
71   -// list of all tables in the database
72   -
73   -
74   -//public define Maybe(String) convert_to_date (MaybeNull(ByteArray) b).
75   -//public define MaybeNull(String) convert_to_date_or_null (MaybeNull(ByteArray) b).
76   -
77   - *** (8.3.6) Converting 'integer?' and 'integer?_or_null' to and fro.
78   -
79   - The next functions are used for integer16, integer32 and integer.
80   -
81   -//public define Maybe(Int) convert_to_integer (MaybeNull(ByteArray) b).
82   -//public define MaybeNull(Int) convert_to_integer_or_null (MaybeNull(ByteArray) b).
83   -
84   -
85   - *** (8.3.7) Converting 'char/text' and 'char_or_null/text_or_null' to and fro.
86   -
87   - The same functions are used for 'text/text_or_null' and 'vartext/vartext_or_null'.
88   -
89   - Litteral texts must be 'prepared' before they can be included into
90   - SQL commands (this amounts to doubling the single quotes).
91   -
92   - public define MetaSQL_Prepared prepare_text (String t).
93   - public define MetaSQL_Prepared prepare_text_or_null (MaybeNull(String) t).
94   -
95   - Conversely, texts arrive from the database in the form of byte arrays which must be
96   - converted to strings. The two functions for converting to 'text' and to 'text_or_null'
97   - are almost the same one. The only difference is that 'null' is interpreted as an error in
98   - the case of 'text'.
99 25  
100 26 --- That's all for the public part !----------------------------------------------------------------
101 27  
... ... @@ -144,77 +70,3 @@ define macro Maybe(String)
144 70 }
145 71 }.
146 72  
147   -
148   -
149   - *** [2] Verifications concerning the description of the database and queries.
150   -
151   -
152   -
153   - define Bool
154   - has_forbidden_references
155   - (
156   - String table_name, // the first 3 arguments concern the current table.
157   - MetaSQL_PrimKey pk,
158   - List(HK_Model_Column) columns,
159   - List(HK_Model_Column) forwards, // subsequent tables
160   - List(String) backwards // list of backwards table names
161   - ) =
162   - if columns is
163   - {
164   - [ ] then false, // no forbidden reference found
165   - [col1 . other_cols] then
166   - if is_forbidden_reference(table_name,col1,forwards,backwards)
167   - then true
168   - else has_forbidden_references(table_name,pk,other_cols,forwards,backwards)
169   - }.
170   -
171   - define Bool // returns 'true' if there is at least one forbidden cycle.
172   - has_forbidden_cycles
173   - (
174   - String db_name,
175   - List(HK_Model_Column) tables,
176   - List(String) backwards // names of 'backwards' tables
177   - ) =
178   - if tables is
179   - {
180   - [ ] then false, // no forbidden cycle found
181   - [tab1 . other_tabs] then if tab1 is table(name1,pk1,cols1) then
182   - if has_forbidden_references(name1,pk1,cols1,other_tabs,backwards)
183   - then true
184   - else has_forbidden_cycles(db_name,other_tabs,[name1 . backwards])
185   - }.
186   -
187   - define Bool
188   - is_forbidden_column_name
189   - (
190   - String name
191   - ) =
192   - name = "id" | name = "metasqlcheck".
193   -
194   - define Bool
195   - has_forbidden_column_names
196   - (
197   - HK_Model_Column tab
198   - ) =
199   - if tab is table(_,_,cols) then
200   - mapor((HK_Model_Column cs) |->
201   - if cs is col(name,_,_) then is_forbidden_column_name(name),
202   - cols).
203   -
204   - define Bool
205   - has_forbidden_column_names
206   - (
207   - DB_Model_DB db
208   - ) =
209   - if db is database(_,tables) then
210   - mapor(has_forbidden_column_names,tables).
211   -
212   - *** [3] Generating the target file.
213   -
214   - *** [3.1] Converting a database type into the corresponding Anubis type:
215   -
216   -
217   -
218   -
219   -
220   -
... ...