1 # Copyright (C) 2013-2019 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 from qtsalome import QSqlQuery
21 from Base.tableDeBase import TableDeBase
23 class TableVersions (TableDeBase):
25 TableDeBase.__init__(self,"Versions")
26 self.setField(("id","nomVersion","commentaire"))
27 self.setTypeField(('int','str','str'),('id',))
28 self.cols=" (nomVersion, commentaire) "
30 def createSqlTable(self):
32 texteQuery ="create table Versions(id integer primary key autoincrement, nomVersion varchar(10),"
33 texteQuery+="commentaire varchar(30));"
34 print("Creation de TableVersions : " , query.exec_(texteQuery))
38 self.insereLigneAutoId(('Salome7.2.0',''))
39 self.insereLigneAutoId(('Salome7.3.0',''))
40 self.insereLigneAutoId(('Salome7.4.0',''))
42 def creeVersion(self,version,commentaire=""):
43 self.insereLigneAutoId((version,commentaire))
46 def chercheVersion(self,version):
49 if bool(version) == True :
50 texteQuery ="select id, nomVersion from Versions where id = " + str(version) +";"
52 texteQuery ="select id, nomVersion from Versions where nomVersion ='" + version +"' ;"
53 query.exec_(texteQuery)
57 id=query.value(0).toInt()[0]
58 nom=query.value(1).toString()
59 if nb != 1 : return 0, 0, ""