- Code: Select all
Starting /home/arkay/Projects/QxOrmTest/Release/QxOrmTest...
[QxOrm] qx::QxSqlDatabase : create new database connection in thread '140441613350752' with key '{85e829b3-f3ac-4da6-bb9d-a4bc11c35321}'
[QxOrm] execute sql query failed : CREATE TABLE Account)
Unable to execute statement
near ")": syntax error
[QxOrm] execute sql query failed : INSERT INTO Account) VALUES)
Unable to fetch row
No query
/home/arkay/Projects/QxOrmTest/Release/QxOrmTest exited with code 0
I have tried following the "drug" example, but it didn't compile since the macro QX_REGISTER_(HPP|CPP)_MY_TEST_EXE doesn't exist, I used QX_REGISTER_(HPP|CPP) instead.
- Code: Select all
#ifndef ACCOUNT_H
#define ACCOUNT_H
#include "include/precompiled.h"
class Account {
public:
enum Role {
USER,
ADMIN
};
Account(): activated(true), locked(false), role(USER) {
}
virtual ~Account() {}
long id;
bool activated;
QString alias;
QString password;
QString rememberMe;
QString comment;
QDateTime created;
QString email;
QString homepage;
QString lastIp;
QDateTime lastLogin;
QString location;
bool locked;
Role role;
};
QX_REGISTER_HPP(Account, qx::trait::no_base_class_defined, 1)
#endif // ACCOUNT_H
- Code: Select all
#include "account.h"
QX_REGISTER_CPP(Account)
namespace qx {
template <> void register_class(QxClass<Account> & t) {
t.id(& Account::id, "id"); // Register 'primary key in your database
t.data(& Account::activated, "activated");
t.data(& Account::alias, "alias");
t.data(& Account::password, "password");
t.data(& Account::rememberMe, "rememberMe");
t.data(& Account::comment, "comment");
t.data(& Account::created, "created");
t.data(& Account::email, "email");
t.data(& Account::homepage, "homepage");
t.data(& Account::lastIp, "lastip");
t.data(& Account::lastLogin, "lastLogin");
t.data(& Account::location, "location");
t.data(& Account::locked, "locked");
t.data(& Account::role, "role");
}
}
