diff --git a/calexium_lib b/calexium_lib index d386b8a..9510293 160000 --- a/calexium_lib +++ b/calexium_lib @@ -1 +1 @@ -Subproject commit d386b8ad2c8ba00d22f64fdc3539aa258a06e82f +Subproject commit 9510293f86d189f0c96969f91c3cb48ab5ed3e37 diff --git a/hayamiki_ds_types.aproj b/hayamiki_ds_types.aproj index 70b176e..aaf87ce 100644 --- a/hayamiki_ds_types.aproj +++ b/hayamiki_ds_types.aproj @@ -24,6 +24,7 @@ + @@ -91,6 +92,7 @@ + diff --git a/hayamiki_generator.aproj b/hayamiki_generator.aproj index 5e1731d..eaf427c 100644 --- a/hayamiki_generator.aproj +++ b/hayamiki_generator.aproj @@ -526,6 +526,7 @@ + @@ -785,6 +786,7 @@ + \ No newline at end of file diff --git a/hayamiki_lib b/hayamiki_lib index c6bd97b..c4e83b9 160000 --- a/hayamiki_lib +++ b/hayamiki_lib @@ -1 +1 @@ -Subproject commit c6bd97b105cf57b04fe2daf4482ba45e119c7b5d +Subproject commit c4e83b952dc316498f5e586cb822803b2c26c281 diff --git a/src/generation/create_table.anubis b/src/generation/create_table.anubis index 8320078..93e040d 100644 --- a/src/generation/create_table.anubis +++ b/src/generation/create_table.anubis @@ -4,7 +4,7 @@ * Date: 24/01/2016 * Time: 18:13 -Hayamiki is Copyright © 2016 by Calexium +Hayamiki is Copyright © 2016-2019 by David RENÉ All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -43,6 +43,150 @@ read columns.anubis read utils/utils.anubis +define List(String) sqlite_reserved_keywords = (List(String)) + [ + "ABORT", + "ACTION", + "ADD", + "AFTER", + "ALL", + "ALTER", + "ANALYZE", + "AND", + "AS", + "ASC", + "ATTACH", + "AUTOINCREMENT", + "BEFORE", + "BEGIN", + "BETWEEN", + "BY", + "CASCADE", + "CASE", + "CAST", + "CHECK", + "COLLATE", + "COLUMN", + "COMMIT", + "CONFLICT", + "CONSTRAINT", + "CREATE", + "CROSS", + "CURRENT", + "CURRENT_DATE", + "CURRENT_TIME", + "CURRENT_TIMESTAMP", + "DATABASE", + "DEFAULT", + "DEFERRABLE", + "DEFERRED", + "DELETE", + "DESC", + "DETACH", + "DISTINCT", + "DO", + "DROP", + "EACH", + "ELSE", + "END", + "ESCAPE", + "EXCEPT", + "EXCLUDE", + "EXCLUSIVE", + "EXISTS", + "EXPLAIN", + "FAIL", + "FILTER", + "FOLLOWING", + "FOR", + "FOREIGN", + "FROM", + "FULL", + "GLOB", + "GROUP", + "GROUPS", + "HAVING", + "IF", + "IGNORE", + "IMMEDIATE", + "IN", + "INDEX", + "INDEXED", + "INITIALLY", + "INNER", + "INSERT", + "INSTEAD", + "INTERSECT", + "INTO", + "IS", + "ISNULL", + "JOIN", + "KEY", + "LEFT", + "LIKE", + "LIMIT", + "MATCH", + "NATURAL", + "NO", + "NOT", + "NOTHING", + "NOTNULL", + "NULL", + "OF", + "OFFSET", + "ON", + "OR", + "ORDER", + "OTHERS", + "OUTER", + "OVER", + "PARTITION", + "PLAN", + "PRAGMA", + "PRECEDING", + "PRIMARY", + "QUERY", + "RAISE", + "RANGE", + "RECURSIVE", + "REFERENCES", + "REGEXP", + "REINDEX", + "RELEASE", + "RENAME", + "REPLACE", + "RESTRICT", + "RIGHT", + "ROLLBACK", + "ROW", + "ROWS", + "SAVEPOINT", + "SELECT", + "SET", + "TABLE", + "TEMP", + "TEMPORARY", + "THEN", + "TIES", + "TO", + "TRANSACTION", + "TRIGGER", + "UNBOUNDED", + "UNION", + "UNIQUE", + "UPDATE", + "USING", + "VACUUM", + "VALUES", + "VIEW", + "VIRTUAL", + "WHEN", + "WHERE", + "WINDOW", + "WITH", + "WITHOUT" +]. + define String create_table_generate_one_column ( @@ -50,7 +194,10 @@ define String Int fill_size )= since column is hk_column(name, col_type, attributes, _), - fill(name, fill_size)+ to_SQL_CREATE(col_type, attributes, name) + if to_upper(name):sqlite_reserved_keywords then + fill("\\\""+name+"\\\"", fill_size)+ to_SQL_CREATE(col_type, attributes, name) + else + fill(name, fill_size)+ to_SQL_CREATE(col_type, attributes, name) . define String @@ -193,7 +340,7 @@ public define Maybe(One) */ read system/logger.anubis -read calexium_lib/net_services_protocols/logger_service.anubis +//read calexium_lib/net_services_protocols/logger_service.anubis read calexium_lib/database/migration_common_sqlite3.anubis read data_base/sqlite_foreign_key.anubis read data_base/db_types.anubis\n"+ @@ -209,8 +356,8 @@ define String _version = \""+version+"\". public define Maybe(One) create_v"+version_str+"_tables ( - SQLite3DataBase db, - Logger logger_debug + SQLite3DataBase db, + (LogLevel, String) -> One logger_debug )= if drop_all_triggers(db, logger_debug) is failure then failure else @@ -257,7 +404,7 @@ read data_base/db_tools.anubis read calexium_lib/database/db_utils.anubis read calexium_lib/database/migration_common_sqlite3.anubis read calexium_lib/database/migration_sqlite3.anubis -read calexium_lib/net_services_protocols/logger_service.anubis +//read calexium_lib/net_services_protocols/logger_service.anubis read data_base/alter_table.anubis read types/app_types.anubis @@ -271,8 +418,8 @@ define String _version = \""+version+"\". public define Maybe(One) create_v"+version_str+"_indexes ( - SQLite3DataBase db, - Logger logger + SQLite3DataBase db, + (LogLevel, String) -> One logger )= if create_indexes(db, logger, db_indexes, _version) is failure then failure else success(unique) @@ -281,22 +428,22 @@ public define Maybe(One) define Maybe(One) to_v"+version_str+"_pre ( - SQLite3DataBase db, - Logger logger + SQLite3DataBase db, + (LogLevel, String) -> One logger )=success(unique). define Maybe(One) to_v"+version_str+"_post ( - SQLite3DataBase db, - Logger logger + SQLite3DataBase db, + (LogLevel, String) -> One logger )=success(unique). public define Maybe(One) migrate_to_v"+version_str+" ( - SQLite3DataBase db, - Logger logger, + SQLite3DataBase db, + (LogLevel, String) -> One logger, )= if to_v"+version_str+"_pre(db, logger) is failure then failure else if create_v"+version_str+"_tables(db, logger) is failure then failure diff --git a/src/generation/header.anubis b/src/generation/header.anubis index e5c2474..a2af70e 100644 --- a/src/generation/header.anubis +++ b/src/generation/header.anubis @@ -72,7 +72,7 @@ transmit system/datetime.anubis transmit system/convert.anubis transmit system/string.anubis -transmit calexium_lib/net_services_protocols/logger_service.anubis +//transmit calexium_lib/net_services_protocols/logger_service.anubis transmit app/app_loggers.anubis ") is failure then failure else foreign_table_header(stream, columns) -- libgit2 0.21.4