11
11
12
12
namespace impeller {
13
13
14
- static const char * const ArchiveColumnPrefix = " item" ;
15
- static const char * const ArchivePrimaryKeyColumnName = " name" ;
16
- static const char * const ArchiveTablePrefix = " RL_" ;
14
+ static const char * const ArchiveColumnPrefix = " col_" ;
15
+ static const char * const ArchivePrimaryKeyColumnName = " primary_key" ;
17
16
18
17
ArchiveClassRegistration::ArchiveClassRegistration (ArchiveDatabase& database,
19
18
ArchiveDef definition)
20
- : database_(database), class_name_(definition.className ) {
19
+ : database_(database), class_name_(definition.table_name ) {
21
20
/*
22
21
* Each class in the archive class hierarchy is assigned an entry in the
23
22
* class map.
@@ -31,11 +30,11 @@ ArchiveClassRegistration::ArchiveClassRegistration(ArchiveDatabase& database,
31
30
for (const auto & member : current->members ) {
32
31
map[member] = currentMember++;
33
32
}
34
- class_map_[current->className ] = map;
35
- current = current->superClass ;
33
+ class_map_[current->table_name ] = map;
34
+ current = current->isa ;
36
35
}
37
36
38
- is_ready_ = CreateTable (definition.autoAssignName );
37
+ is_ready_ = CreateTable (definition.auto_key );
39
38
}
40
39
41
40
const std::string& ArchiveClassRegistration::GetClassName () const {
@@ -81,8 +80,8 @@ bool ArchiveClassRegistration::CreateTable(bool autoIncrement) {
81
80
* Table names cannot participate in parameter substitution, so we prepare
82
81
* a statement and check its validity before running.
83
82
*/
84
- stream << " CREATE TABLE IF NOT EXISTS " << ArchiveTablePrefix
85
- << class_name_. c_str () << " ( " << ArchivePrimaryKeyColumnName;
83
+ stream << " CREATE TABLE IF NOT EXISTS " << class_name_. c_str () << " ( "
84
+ << ArchivePrimaryKeyColumnName;
86
85
87
86
if (autoIncrement) {
88
87
stream << " INTEGER PRIMARY KEY AUTOINCREMENT, " ;
@@ -120,7 +119,7 @@ ArchiveStatement ArchiveClassRegistration::GetQueryStatement(
120
119
stream << " ," ;
121
120
}
122
121
}
123
- stream << " FROM " << ArchiveTablePrefix << class_name_;
122
+ stream << " FROM " << class_name_;
124
123
125
124
if (single) {
126
125
stream << " WHERE " << ArchivePrimaryKeyColumnName << " = ?" ;
@@ -135,8 +134,7 @@ ArchiveStatement ArchiveClassRegistration::GetQueryStatement(
135
134
136
135
ArchiveStatement ArchiveClassRegistration::GetInsertStatement () const {
137
136
std::stringstream stream;
138
- stream << " INSERT OR REPLACE INTO " << ArchiveTablePrefix << class_name_
139
- << " VALUES ( ?, " ;
137
+ stream << " INSERT OR REPLACE INTO " << class_name_ << " VALUES ( ?, " ;
140
138
for (size_t i = 0 ; i < member_count_; i++) {
141
139
stream << " ?" ;
142
140
if (i != member_count_ - 1 ) {
0 commit comments