Hello,

i have two database questions:

1.) Each user should sees a consistent view of the data. What have i to do
if two or more user have simultaneously access to my database?

2.) What are the right classes to set a QDataWidgetMapper for my database?

I have try to use QSqlTableModel, but the problem is, one dataset can include
data fom the table "Experiment", "Temperatur" and "Qualities". How can i get
a Model for the QDataWidgetMapper to handle this?

gui.png

Qt Code:
  1. model->setTable("Temperatur");
  2. model->setFilter("ExperimentID=" + QString::number(ID));
  3. model->select();
  4.  
  5. mapper->setModel(model);
  6. mapper->setItemDelegate(new QSqlRelationalDelegate(this));
  7. mapper->addMapping(min, model->fieldIndex("min"));
  8. mapper->addMapping(max, model->fieldIndex("max"));
  9. mapper->toFirst();
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. CREATE TABLE [Experiment]
  2. (
  3. [ExperimentID] integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  4. [Name] varchar (100) NOT NULL,
  5. [Date] datetime NOT NULL DEFAULT '0000-00-00'
  6. );
  7.  
  8.  
  9. CREATE TABLE [Temperatur]
  10. (
  11. [ExperimentID] integer NOT NULL DEFAULT 0,
  12. [min] integer DEFAULT 0,
  13. [max] integer DEFAULT 0,
  14. [average] integer DEFAULT 0,
  15. ...
  16. );
  17.  
  18. CREATE TABLE[Qualities]
  19. (
  20. [ExperimentID] integer NOT NULL DEFAULT 0,
  21. [material] integer DEFAULT 0,
  22. [fuel] integer DEFAULT 0,
  23. [container] integer DEFAULT 0,
  24. ...
  25. );
To copy to clipboard, switch view to plain text mode