1 from qtsalome import QSqlQuery
2 from .tableDeBase import TableDeBase
4 class TableGroupeTailles (TableDeBase):
6 TableDeBase.__init__(self,"GroupeTailles")
7 self.setField(('Maillage','Version','Groupe','TailleMax','TailleMin','Quartile1','Mediane','Quartile3','Moyenne'))
8 self.setTypeField(('int','int','str','float','float','float','float','float','float'),('idMaillage','idVersion'))
10 def createSqlTable(self):
13 texteQuery ="create table GroupeTailles(idMaillage int, idVersion int, "
14 texteQuery+="Groupe varchar(40),TailleMax float, TailleMin float, "
15 texteQuery+="Q1 float, "
16 texteQuery+="Mediane float, "
17 texteQuery+="Q3 float, "
18 texteQuery+="Moyenne float, "
19 texteQuery+="foreign key (idMaillage) references Maillages(id),"
20 texteQuery+="foreign key (idVersion) references Versions(id),"
21 texteQuery+="foreign key (Groupe) references GroupesRef(nomGroupe),"
22 texteQuery+="primary key (idMaillage,idVersion,Groupe));"
24 print("Creation de TableGroupeTailles : " , query.exec_(texteQuery))
26 def getVal(self,idMaillage, idVersion, Groupe, Entite):
28 texteQuery ='select '+ str(Entite) + ' from GroupeTailles where idMaillage='+str(idMaillage)
29 texteQuery+=' and idVersion='+str(idVersion)
30 texteQuery+=" and Groupe='" + str(Groupe) +"';"
31 query.exec_(texteQuery)
33 val=0 # Valeur si l enregistrement n existe pas
35 val=query.value(0).toFloat()[0]
37 if nb > 1 : print("Double valeur de Reference dans la table des tailles")