The createTables() function is too big. Here is a part of it

Qt Code:
  1. QSqlQuery query;
  2.  
  3. if(query.exec("create table cgroup(id INTEGER PRIMARY KEY,name TEXT,category INTEGER,operator TEXT)")){
  4. if(query.exec("insert into cgroup (id,name,category) values (NULL,'All',1)")){
  5. if(query.exec("select * from cgroup")){
  6. if(query.first()){
  7. QSqlRecord r = query.record();
  8. gid = r.value("id").toInt();
  9. }
  10. }
  11. if(query.exec("create table group_contacts(id INTEGER PRIMARY KEY,"
  12. "nameid INTEGER, groupid INTEGER, emailid INTEGER, phoneid INTEGER, addressid INTEGER)")){
  13. if(query.exec("insert into group_contacts(id,nameid,groupid) "
  14. "values (NULL, " + QString::number(nid) + ", " + QString::number(gid) +
  15. ")")){
  16.  
  17. }
  18. }
  19. }
  20. }
To copy to clipboard, switch view to plain text mode