13 #include <sql_buffer.h> 15 #include <rapidjson/document.h> 20 #define DDL_BACKOFF 50 // Microseconds to backoff between DDL retries 37 Schema(
const std::string& name,
const std::string& service,
int version,
38 const std::string& definition);
39 Schema(sqlite3 *db,
const rapidjson::Document& doc);
41 int getVersion() {
return m_version; };
42 std::string getService() {
return m_service; };
43 bool upgrade(sqlite3 *db,
const rapidjson::Document& doc,
const std::string& definition);
47 std::string m_service;
49 std::string m_definition;
51 std::string m_schemaPath;
52 std::map<sqlite3 *, bool>
55 bool createTable(sqlite3 *db,
const rapidjson::Value& table);
56 bool createIndex(sqlite3 *db,
const std::string& table,
57 const rapidjson::Value& index);
58 bool hasTable(
const rapidjson::Document& doc,
const std::string& table);
59 bool hasColumn(
const rapidjson::Document& doc,
const std::string& table,
60 const std::string& column);
61 bool addTableColumn(sqlite3 *db,
const std::string& table,
62 const rapidjson::Value& column);
63 bool executeDDL(sqlite3 *db,
SQLBuffer& sql);
65 bool hasString(
const rapidjson::Value& value,
const char *key)
67 return (value.HasMember(key) && value[key].IsString());
69 bool hasInt(
const rapidjson::Value& value,
const char *key)
71 return (value.HasMember(key) && value[key].IsInt());
73 bool hasArray(
const rapidjson::Value& value,
const char *key)
75 return (value.HasMember(key) && value[key].IsArray());
77 bool createDatabase();
78 void setDatabasePath();
88 void load(sqlite3 *db);
89 bool create(sqlite3 *db,
const std::string& definition);
90 bool exists(sqlite3 *db,
const std::string& schema);
97 std::map<std::string, Schema *> m_schema;
Fledge Logger class used to log to syslog.
Definition: logger.h:26
Representation of an extension schema.
Definition: schema.h:35
Buffer class designed to hold SQL statement that can as required but have minimal copy semantics...
Definition: sql_buffer.h:22
bool attach(sqlite3 *db)
Attach the schema to the database handle if not already attached.
Definition: schema.cpp:825
The singleton SchemaManager class used to interact with the extension schemas created by various exte...
Definition: schema.h:85
bool upgrade(sqlite3 *db, const rapidjson::Document &doc, const std::string &definition)
Upgrade an existing schema.
Definition: schema.cpp:420