if(query.exec("create table cgroup(id INTEGER PRIMARY KEY,name TEXT,category INTEGER,operator TEXT)")){
if(query.exec("insert into cgroup (id,name,category) values (NULL,'All',1)")){
if(query.exec("select * from cgroup")){
if(query.first()){
gid = r.value("id").toInt();
}
}
if(query.exec("create table group_contacts(id INTEGER PRIMARY KEY,"
"nameid INTEGER, groupid INTEGER, emailid INTEGER, phoneid INTEGER, addressid INTEGER)")){
if(query.exec("insert into group_contacts(id,nameid,groupid) "
"values (NULL, " + QString::number(nid
) + ", " + QString::number(gid
) + ")")){
}
}
}
}
QSqlQuery query;
if(query.exec("create table cgroup(id INTEGER PRIMARY KEY,name TEXT,category INTEGER,operator TEXT)")){
if(query.exec("insert into cgroup (id,name,category) values (NULL,'All',1)")){
if(query.exec("select * from cgroup")){
if(query.first()){
QSqlRecord r = query.record();
gid = r.value("id").toInt();
}
}
if(query.exec("create table group_contacts(id INTEGER PRIMARY KEY,"
"nameid INTEGER, groupid INTEGER, emailid INTEGER, phoneid INTEGER, addressid INTEGER)")){
if(query.exec("insert into group_contacts(id,nameid,groupid) "
"values (NULL, " + QString::number(nid) + ", " + QString::number(gid) +
")")){
}
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks