Revision cca74b24
Von Christian Ehringfeld vor fast 6 Jahren hinzugefügt
samples/simple/main.cpp | ||
---|---|---|
QSharedPointer<CuteEntityManager::EntityManager> e =
|
||
QSharedPointer<CuteEntityManager::EntityManager>(new
|
||
CuteEntityManager::EntityManager("QSQLITE",
|
||
QDir::currentPath() + "/db.sqlite"));
|
||
QDir::currentPath() + "/db.sqlite","","","test"));
|
||
QStringList inits = QStringList() << "Article";
|
||
e->startup("0.1", inits);
|
||
QSharedPointer<Article> a = QSharedPointer<Article>(new Article(5.0,
|
src/database.cpp | ||
---|---|---|
switch (db) {
|
||
case DatabaseType::SQLITE:
|
||
return new SqliteSchema(database);
|
||
break;
|
||
// case PGSQL:
|
||
// return QSharedPointer<Schema>(new PgSqlSchema());
|
||
// break;
|
||
case DatabaseType::MYSQL:
|
||
return new MysqlSchema(database);
|
||
break;
|
||
default:
|
||
return new SqliteSchema(database);
|
||
break;
|
||
}
|
||
}
|
||
|
src/entitymanager.cpp | ||
---|---|---|
hostname,
|
||
databasename, username,
|
||
password,
|
||
port.toInt(), true, logQueries, databaseOptions, logActions));
|
||
port.toInt(), logQueries, true, databaseOptions, logActions));
|
||
this->init(inspectEntities, logActions);
|
||
}
|
||
|
src/schema/sqliteschema.cpp | ||
---|---|---|
|
||
SqliteSchema::SqliteSchema(QSharedPointer<Database> database) : Schema(
|
||
database, QSharedPointer<QueryBuilder>(new SqliteQueryBuilder(this, database))) {
|
||
if(this->tables.empty()) {
|
||
QStringList inits = QStringList() << "PRAGMA locking_mode = EXCLUSIVE;"<<"PRAGMA synchronous = 1;" << "PRAGMA journal_mode = WAL;" << "PRAGMA wal_autocheckpoint = 16;" << "PRAGMA journal_size_limit = 1536;" << "PRAGMA temp_store = MEMORY;" << "PRAGMA foreign_keys = ON;";
|
||
database->exec(inits);
|
||
}
|
||
}
|
||
|
||
SqliteSchema::~SqliteSchema() {
|
Auch abrufbar als: Unified diff
imp