diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-07-11 18:09:02 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-07-11 18:09:02 +0200 |
commit | 60082c69f13715ac0e2f75c5e99578595dbfb7b9 (patch) | |
tree | bad13da819f7aaf03f3d8d679d30fd1022d64b32 /src | |
parent | test: more compact CI scripts (diff) | |
download | cimple-60082c69f13715ac0e2f75c5e99578595dbfb7b9.tar.gz cimple-60082c69f13715ac0e2f75c5e99578595dbfb7b9.zip |
sqlite: rename SQL schema variables
Diffstat (limited to 'src')
-rwxr-xr-x | src/generate-sql-header.py | 6 | ||||
-rw-r--r-- | src/storage_sqlite.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/generate-sql-header.py b/src/generate-sql-header.py index 78f0517..52699c6 100755 --- a/src/generate-sql-header.py +++ b/src/generate-sql-header.py @@ -42,11 +42,11 @@ class Generator: @property def var_name_prefix(self): - return f'sql_{self.name}' + return f'{self.name}' def sql_file_to_var_name(self, path): name = os.path.splitext(os.path.basename(path))[0] - return f'{self.var_name_prefix}_{name}' + return f'{self.var_name_prefix}_schema_{name}' @staticmethod def sql_file_to_string_literal(path): @@ -64,7 +64,7 @@ class Generator: value = self.sql_file_to_string_literal(path) self.write(f'static const char *const {name} = "{value}";') self.write('') - self.write(f'static const char *const {self.var_name_prefix}_files[] = {{') + self.write(f'static const char *const {self.var_name_prefix}_schemas[] = {{') for var in vars: self.write(f'\t{var},') self.write('};') diff --git a/src/storage_sqlite.c b/src/storage_sqlite.c index 981a5dd..8bee6f1 100644 --- a/src/storage_sqlite.c +++ b/src/storage_sqlite.c @@ -120,7 +120,7 @@ static int storage_sqlite_upgrade_to(struct storage_sqlite *storage, size_t vers { static const char *const fmt = "%s PRAGMA user_version = %zu;"; - const char *script = sql_sqlite_files[version]; + const char *script = sqlite_schemas[version]; int ret = 0; ret = snprintf(NULL, 0, fmt, script, version + 1); @@ -169,7 +169,7 @@ static int storage_sqlite_upgrade(struct storage_sqlite *storage) return ret; log("SQLite database version: %u\n", current_version); - size_t newest_version = sizeof(sql_sqlite_files) / sizeof(sql_sqlite_files[0]); + size_t newest_version = sizeof(sqlite_schemas) / sizeof(sqlite_schemas[0]); log("Newest database version: %zu\n", newest_version); if (current_version > newest_version) { |