def getAllMagasin(parameters_path): result = [] strquery = "SELECT * from magasin Where visible =True " db = connexion.connect(parameters_path) for r in db.query( # just for example strquery).dictresult(): result.append(r) return result
def getAllTypeProduit(parameters_path): result = [] strquery = "SELECT DISTINCT * from typeproduit Where visible =True " db = connexion.connect(parameters_path) # q = db.query(strquery) # result = q.getresult() # print(result) for r in db.query( # just for example strquery).dictresult(): result.append(r) return result
def updateTypeProduit(parameters_path, jsonobject, typeproduitid): strquery = "" # jsonobject = json.loads(jsonobject) for key, value in jsonobject.items(): strquery = strquery + ", " + key + "=" + "'" + value + "'" strquery = strquery.strip(", ") strquery = "UPDATE typeproduit SET " + strquery + " WHERE typeproduitid = " + str( typeproduitid) db = connexion.connect(parameters_path) q = db.query(strquery) return q
def updateMagasin(parameters_path, jsonobject, magasinId): strquery = "" # jsonobject = json.loads(jsonobject) for key, value in jsonobject.items(): strquery = strquery + ", " + key + "=" + "'" + value + "'" strquery = strquery.strip(", ") strquery = "UPDATE magasin SET " + strquery + " WHERE magasinid = " + str( magasinId) print(strquery) db = connexion.connect(parameters_path) q = db.query(strquery) return q
def getTypeProduitByCriteria(parameters_path, jsonobject): strquery = "" result = [] # jsonobject = json.loads(jsonobject) for key, value in jsonobject.items(): strquery = strquery + " and " + key + "=" + "'" + value + "'" strquery = strquery.strip(" and ") strquery = "SELECT DISTINCT * From typeproduit WHERE " + strquery db = connexion.connect(parameters_path) # q = db.query(strquery) # result = q.getresult() for r in db.query( # just for example strquery).dictresult(): result.append(r) return result
def createProduit(parameters_path, jsonobject): strkey = "" strvalues = "" # jsonobject = json.loads(jsonobject) for key, value in jsonobject.items(): strkey = strkey+ ", "+ key strvalues = strvalues + ", "+ "'"+value + "'" strkey = strkey.strip(", ") strkey = strkey + ", visible" strvalues = strvalues.strip(", ") strvalues = strvalues + ", True" strquery = "INSERT INTO produit ( " + strkey + ") VALUES (" + strvalues + ")" db = connexion.connect(parameters_path) q = db.query(strquery) return q
def deleteTypeProduit(parameters_path, typeproduitid): strquery = "UPDATE typeproduit SET visible = False WHERE typeproduitid = " + str( typeproduitid) db = connexion.connect(parameters_path) q = db.query(strquery) return q
def deleteMagasin(parameters_path, magasinId): strquery = "UPDATE magasin SET visible = False WHERE magasinid = " + str( magasinId) db = connexion.connect(parameters_path) q = db.query(strquery) return q
def deleteAcquisition(parameters_path, AcquisitionId): strquery = "UPDATE acquisition SET visible = False WHERE acquisitionid = " + str( AcquisitionId) db = connexion.connect(parameters_path) q = db.query(strquery) return q