Commit 2cbbcc8f2bf4722767c502c474201ed00e37b8a2
1 parent
43bb3ad2
fix column name with reserved key name by surrounding it with ".
update the generator according to the new logger call (log server) by removing read of logger_service.anubis and change the Logger by (LogLevel, String) -> One provided by host applicaiton
Showing
6 changed files
with
168 additions
and
17 deletions
Show diff stats
calexium_lib @ 9510293f86d
hayamiki_ds_types.aproj
| @@ -24,6 +24,7 @@ | @@ -24,6 +24,7 @@ | ||
| 24 | <Import Project="$(AnubisBinPath)\Anubis.Build.targets" /> | 24 | <Import Project="$(AnubisBinPath)\Anubis.Build.targets" /> |
| 25 | <ItemGroup> | 25 | <ItemGroup> |
| 26 | <Compile Include="hayamiki_ds_types.anubis" /> | 26 | <Compile Include="hayamiki_ds_types.anubis" /> |
| 27 | + <Compile Include="hayamiki_lib\app\app_constant.anubis" /> | ||
| 27 | <Compile Include="hayamiki_lib\controller\hk_controller.anubis" /> | 28 | <Compile Include="hayamiki_lib\controller\hk_controller.anubis" /> |
| 28 | <Compile Include="hayamiki_lib\controller\hk_delete.anubis" /> | 29 | <Compile Include="hayamiki_lib\controller\hk_delete.anubis" /> |
| 29 | <Compile Include="hayamiki_lib\controller\hk_rows_import.anubis" /> | 30 | <Compile Include="hayamiki_lib\controller\hk_rows_import.anubis" /> |
| @@ -91,6 +92,7 @@ | @@ -91,6 +92,7 @@ | ||
| 91 | <Folder Include="hayamiki_lib\ds_files" /> | 92 | <Folder Include="hayamiki_lib\ds_files" /> |
| 92 | <Folder Include="hayamiki_lib\model" /> | 93 | <Folder Include="hayamiki_lib\model" /> |
| 93 | <Folder Include="hayamiki_lib\model\types" /> | 94 | <Folder Include="hayamiki_lib\model\types" /> |
| 95 | + <Folder Include="hayamiki_lib\app" /> | ||
| 94 | <Folder Include="hayamiki_lib\types" /> | 96 | <Folder Include="hayamiki_lib\types" /> |
| 95 | <Folder Include="hayamiki_lib\view" /> | 97 | <Folder Include="hayamiki_lib\view" /> |
| 96 | <Folder Include="hayamiki_lib\view\types" /> | 98 | <Folder Include="hayamiki_lib\view\types" /> |
hayamiki_generator.aproj
| @@ -526,6 +526,7 @@ | @@ -526,6 +526,7 @@ | ||
| 526 | <Compile Include="library\widgets4\window_test.anubis" /> | 526 | <Compile Include="library\widgets4\window_test.anubis" /> |
| 527 | <Compile Include="library\xml\basic_xml_parser.anubis" /> | 527 | <Compile Include="library\xml\basic_xml_parser.anubis" /> |
| 528 | <Compile Include="library\xml\xml_parser.apg.anubis" /> | 528 | <Compile Include="library\xml\xml_parser.apg.anubis" /> |
| 529 | + <Compile Include="src\app\app_constants.anubis" /> | ||
| 529 | <Compile Include="src\check.anubis" /> | 530 | <Compile Include="src\check.anubis" /> |
| 530 | <Compile Include="src\generation\anubis.anubis" /> | 531 | <Compile Include="src\generation\anubis.anubis" /> |
| 531 | <Compile Include="src\generation\choices_selector.anubis" /> | 532 | <Compile Include="src\generation\choices_selector.anubis" /> |
| @@ -785,6 +786,7 @@ | @@ -785,6 +786,7 @@ | ||
| 785 | <Folder Include="library\xml" /> | 786 | <Folder Include="library\xml" /> |
| 786 | <Folder Include="src" /> | 787 | <Folder Include="src" /> |
| 787 | <Folder Include="src\generation" /> | 788 | <Folder Include="src\generation" /> |
| 789 | + <Folder Include="src\app" /> | ||
| 788 | <Folder Include="src\utils" /> | 790 | <Folder Include="src\utils" /> |
| 789 | </ItemGroup> | 791 | </ItemGroup> |
| 790 | </Project> | 792 | </Project> |
| 791 | \ No newline at end of file | 793 | \ No newline at end of file |
hayamiki_lib @ c4e83b952dc
src/generation/create_table.anubis
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | * Date: 24/01/2016 | 4 | * Date: 24/01/2016 |
| 5 | * Time: 18:13 | 5 | * Time: 18:13 |
| 6 | 6 | ||
| 7 | -Hayamiki is Copyright © 2016 by Calexium | 7 | +Hayamiki is Copyright © 2016-2019 by David RENÉ |
| 8 | All rights reserved. | 8 | All rights reserved. |
| 9 | 9 | ||
| 10 | Redistribution and use in source and binary forms, with or without modification, | 10 | Redistribution and use in source and binary forms, with or without modification, |
| @@ -43,6 +43,150 @@ read columns.anubis | @@ -43,6 +43,150 @@ read columns.anubis | ||
| 43 | 43 | ||
| 44 | read utils/utils.anubis | 44 | read utils/utils.anubis |
| 45 | 45 | ||
| 46 | +define List(String) sqlite_reserved_keywords = (List(String)) | ||
| 47 | + [ | ||
| 48 | + "ABORT", | ||
| 49 | + "ACTION", | ||
| 50 | + "ADD", | ||
| 51 | + "AFTER", | ||
| 52 | + "ALL", | ||
| 53 | + "ALTER", | ||
| 54 | + "ANALYZE", | ||
| 55 | + "AND", | ||
| 56 | + "AS", | ||
| 57 | + "ASC", | ||
| 58 | + "ATTACH", | ||
| 59 | + "AUTOINCREMENT", | ||
| 60 | + "BEFORE", | ||
| 61 | + "BEGIN", | ||
| 62 | + "BETWEEN", | ||
| 63 | + "BY", | ||
| 64 | + "CASCADE", | ||
| 65 | + "CASE", | ||
| 66 | + "CAST", | ||
| 67 | + "CHECK", | ||
| 68 | + "COLLATE", | ||
| 69 | + "COLUMN", | ||
| 70 | + "COMMIT", | ||
| 71 | + "CONFLICT", | ||
| 72 | + "CONSTRAINT", | ||
| 73 | + "CREATE", | ||
| 74 | + "CROSS", | ||
| 75 | + "CURRENT", | ||
| 76 | + "CURRENT_DATE", | ||
| 77 | + "CURRENT_TIME", | ||
| 78 | + "CURRENT_TIMESTAMP", | ||
| 79 | + "DATABASE", | ||
| 80 | + "DEFAULT", | ||
| 81 | + "DEFERRABLE", | ||
| 82 | + "DEFERRED", | ||
| 83 | + "DELETE", | ||
| 84 | + "DESC", | ||
| 85 | + "DETACH", | ||
| 86 | + "DISTINCT", | ||
| 87 | + "DO", | ||
| 88 | + "DROP", | ||
| 89 | + "EACH", | ||
| 90 | + "ELSE", | ||
| 91 | + "END", | ||
| 92 | + "ESCAPE", | ||
| 93 | + "EXCEPT", | ||
| 94 | + "EXCLUDE", | ||
| 95 | + "EXCLUSIVE", | ||
| 96 | + "EXISTS", | ||
| 97 | + "EXPLAIN", | ||
| 98 | + "FAIL", | ||
| 99 | + "FILTER", | ||
| 100 | + "FOLLOWING", | ||
| 101 | + "FOR", | ||
| 102 | + "FOREIGN", | ||
| 103 | + "FROM", | ||
| 104 | + "FULL", | ||
| 105 | + "GLOB", | ||
| 106 | + "GROUP", | ||
| 107 | + "GROUPS", | ||
| 108 | + "HAVING", | ||
| 109 | + "IF", | ||
| 110 | + "IGNORE", | ||
| 111 | + "IMMEDIATE", | ||
| 112 | + "IN", | ||
| 113 | + "INDEX", | ||
| 114 | + "INDEXED", | ||
| 115 | + "INITIALLY", | ||
| 116 | + "INNER", | ||
| 117 | + "INSERT", | ||
| 118 | + "INSTEAD", | ||
| 119 | + "INTERSECT", | ||
| 120 | + "INTO", | ||
| 121 | + "IS", | ||
| 122 | + "ISNULL", | ||
| 123 | + "JOIN", | ||
| 124 | + "KEY", | ||
| 125 | + "LEFT", | ||
| 126 | + "LIKE", | ||
| 127 | + "LIMIT", | ||
| 128 | + "MATCH", | ||
| 129 | + "NATURAL", | ||
| 130 | + "NO", | ||
| 131 | + "NOT", | ||
| 132 | + "NOTHING", | ||
| 133 | + "NOTNULL", | ||
| 134 | + "NULL", | ||
| 135 | + "OF", | ||
| 136 | + "OFFSET", | ||
| 137 | + "ON", | ||
| 138 | + "OR", | ||
| 139 | + "ORDER", | ||
| 140 | + "OTHERS", | ||
| 141 | + "OUTER", | ||
| 142 | + "OVER", | ||
| 143 | + "PARTITION", | ||
| 144 | + "PLAN", | ||
| 145 | + "PRAGMA", | ||
| 146 | + "PRECEDING", | ||
| 147 | + "PRIMARY", | ||
| 148 | + "QUERY", | ||
| 149 | + "RAISE", | ||
| 150 | + "RANGE", | ||
| 151 | + "RECURSIVE", | ||
| 152 | + "REFERENCES", | ||
| 153 | + "REGEXP", | ||
| 154 | + "REINDEX", | ||
| 155 | + "RELEASE", | ||
| 156 | + "RENAME", | ||
| 157 | + "REPLACE", | ||
| 158 | + "RESTRICT", | ||
| 159 | + "RIGHT", | ||
| 160 | + "ROLLBACK", | ||
| 161 | + "ROW", | ||
| 162 | + "ROWS", | ||
| 163 | + "SAVEPOINT", | ||
| 164 | + "SELECT", | ||
| 165 | + "SET", | ||
| 166 | + "TABLE", | ||
| 167 | + "TEMP", | ||
| 168 | + "TEMPORARY", | ||
| 169 | + "THEN", | ||
| 170 | + "TIES", | ||
| 171 | + "TO", | ||
| 172 | + "TRANSACTION", | ||
| 173 | + "TRIGGER", | ||
| 174 | + "UNBOUNDED", | ||
| 175 | + "UNION", | ||
| 176 | + "UNIQUE", | ||
| 177 | + "UPDATE", | ||
| 178 | + "USING", | ||
| 179 | + "VACUUM", | ||
| 180 | + "VALUES", | ||
| 181 | + "VIEW", | ||
| 182 | + "VIRTUAL", | ||
| 183 | + "WHEN", | ||
| 184 | + "WHERE", | ||
| 185 | + "WINDOW", | ||
| 186 | + "WITH", | ||
| 187 | + "WITHOUT" | ||
| 188 | +]. | ||
| 189 | + | ||
| 46 | define String | 190 | define String |
| 47 | create_table_generate_one_column | 191 | create_table_generate_one_column |
| 48 | ( | 192 | ( |
| @@ -50,7 +194,10 @@ define String | @@ -50,7 +194,10 @@ define String | ||
| 50 | Int fill_size | 194 | Int fill_size |
| 51 | )= | 195 | )= |
| 52 | since column is hk_column(name, col_type, attributes, _), | 196 | since column is hk_column(name, col_type, attributes, _), |
| 53 | - fill(name, fill_size)+ to_SQL_CREATE(col_type, attributes, name) | 197 | + if to_upper(name):sqlite_reserved_keywords then |
| 198 | + fill("\\\""+name+"\\\"", fill_size)+ to_SQL_CREATE(col_type, attributes, name) | ||
| 199 | + else | ||
| 200 | + fill(name, fill_size)+ to_SQL_CREATE(col_type, attributes, name) | ||
| 54 | . | 201 | . |
| 55 | 202 | ||
| 56 | define String | 203 | define String |
| @@ -193,7 +340,7 @@ public define Maybe(One) | @@ -193,7 +340,7 @@ public define Maybe(One) | ||
| 193 | */ | 340 | */ |
| 194 | 341 | ||
| 195 | read system/logger.anubis | 342 | read system/logger.anubis |
| 196 | -read calexium_lib/net_services_protocols/logger_service.anubis | 343 | +//read calexium_lib/net_services_protocols/logger_service.anubis |
| 197 | read calexium_lib/database/migration_common_sqlite3.anubis | 344 | read calexium_lib/database/migration_common_sqlite3.anubis |
| 198 | read data_base/sqlite_foreign_key.anubis | 345 | read data_base/sqlite_foreign_key.anubis |
| 199 | read data_base/db_types.anubis\n"+ | 346 | read data_base/db_types.anubis\n"+ |
| @@ -209,8 +356,8 @@ define String _version = \""+version+"\". | @@ -209,8 +356,8 @@ define String _version = \""+version+"\". | ||
| 209 | public define Maybe(One) | 356 | public define Maybe(One) |
| 210 | create_v"+version_str+"_tables | 357 | create_v"+version_str+"_tables |
| 211 | ( | 358 | ( |
| 212 | - SQLite3DataBase db, | ||
| 213 | - Logger logger_debug | 359 | + SQLite3DataBase db, |
| 360 | + (LogLevel, String) -> One logger_debug | ||
| 214 | )= | 361 | )= |
| 215 | if drop_all_triggers(db, logger_debug) is failure then failure else | 362 | if drop_all_triggers(db, logger_debug) is failure then failure else |
| 216 | 363 | ||
| @@ -257,7 +404,7 @@ read data_base/db_tools.anubis | @@ -257,7 +404,7 @@ read data_base/db_tools.anubis | ||
| 257 | read calexium_lib/database/db_utils.anubis | 404 | read calexium_lib/database/db_utils.anubis |
| 258 | read calexium_lib/database/migration_common_sqlite3.anubis | 405 | read calexium_lib/database/migration_common_sqlite3.anubis |
| 259 | read calexium_lib/database/migration_sqlite3.anubis | 406 | read calexium_lib/database/migration_sqlite3.anubis |
| 260 | -read calexium_lib/net_services_protocols/logger_service.anubis | 407 | +//read calexium_lib/net_services_protocols/logger_service.anubis |
| 261 | read data_base/alter_table.anubis | 408 | read data_base/alter_table.anubis |
| 262 | 409 | ||
| 263 | read types/app_types.anubis | 410 | read types/app_types.anubis |
| @@ -271,8 +418,8 @@ define String _version = \""+version+"\". | @@ -271,8 +418,8 @@ define String _version = \""+version+"\". | ||
| 271 | public define Maybe(One) | 418 | public define Maybe(One) |
| 272 | create_v"+version_str+"_indexes | 419 | create_v"+version_str+"_indexes |
| 273 | ( | 420 | ( |
| 274 | - SQLite3DataBase db, | ||
| 275 | - Logger logger | 421 | + SQLite3DataBase db, |
| 422 | + (LogLevel, String) -> One logger | ||
| 276 | )= | 423 | )= |
| 277 | if create_indexes(db, logger, db_indexes, _version) is failure then failure else | 424 | if create_indexes(db, logger, db_indexes, _version) is failure then failure else |
| 278 | success(unique) | 425 | success(unique) |
| @@ -281,22 +428,22 @@ public define Maybe(One) | @@ -281,22 +428,22 @@ public define Maybe(One) | ||
| 281 | define Maybe(One) | 428 | define Maybe(One) |
| 282 | to_v"+version_str+"_pre | 429 | to_v"+version_str+"_pre |
| 283 | ( | 430 | ( |
| 284 | - SQLite3DataBase db, | ||
| 285 | - Logger logger | 431 | + SQLite3DataBase db, |
| 432 | + (LogLevel, String) -> One logger | ||
| 286 | )=success(unique). | 433 | )=success(unique). |
| 287 | 434 | ||
| 288 | define Maybe(One) | 435 | define Maybe(One) |
| 289 | to_v"+version_str+"_post | 436 | to_v"+version_str+"_post |
| 290 | ( | 437 | ( |
| 291 | - SQLite3DataBase db, | ||
| 292 | - Logger logger | 438 | + SQLite3DataBase db, |
| 439 | + (LogLevel, String) -> One logger | ||
| 293 | )=success(unique). | 440 | )=success(unique). |
| 294 | 441 | ||
| 295 | public define Maybe(One) | 442 | public define Maybe(One) |
| 296 | migrate_to_v"+version_str+" | 443 | migrate_to_v"+version_str+" |
| 297 | ( | 444 | ( |
| 298 | - SQLite3DataBase db, | ||
| 299 | - Logger logger, | 445 | + SQLite3DataBase db, |
| 446 | + (LogLevel, String) -> One logger, | ||
| 300 | )= | 447 | )= |
| 301 | if to_v"+version_str+"_pre(db, logger) is failure then failure | 448 | if to_v"+version_str+"_pre(db, logger) is failure then failure |
| 302 | else if create_v"+version_str+"_tables(db, logger) is failure then failure | 449 | else if create_v"+version_str+"_tables(db, logger) is failure then failure |
src/generation/header.anubis
| @@ -72,7 +72,7 @@ transmit system/datetime.anubis | @@ -72,7 +72,7 @@ transmit system/datetime.anubis | ||
| 72 | transmit system/convert.anubis | 72 | transmit system/convert.anubis |
| 73 | transmit system/string.anubis | 73 | transmit system/string.anubis |
| 74 | 74 | ||
| 75 | -transmit calexium_lib/net_services_protocols/logger_service.anubis | 75 | +//transmit calexium_lib/net_services_protocols/logger_service.anubis |
| 76 | transmit app/app_loggers.anubis | 76 | transmit app/app_loggers.anubis |
| 77 | ") is failure then failure else | 77 | ") is failure then failure else |
| 78 | foreign_table_header(stream, columns) | 78 | foreign_table_header(stream, columns) |