Beispiel #1
0
 def test_get_sql_data(self):
     print("0")
     inp=[['class1', 'class2'], {'body': '', 'frequency': '', 'joinClass': ['class1', 'class2'], 'name': 'query1', 'queryType': 'select', 'selected': True}, {'name': 'query2', 'body': '', 'selected': True, 'queryType': '', 'joinClass': [], 'frequency': ''}]
     out={'data': [['class1', 'class2'], [0, 1], [1, 0]]}
     self.assertEqual(sql.get_sql_data(inp), out)
     inp=[['class1', 'class2', 'class3', 'class4', 'zz', 'class5'], {'name': 'query1', 'body': '', 'selected': True, 'queryType': 'select', 'joinClass': ['class1', 'class2'], 'frequency': ''}, {'name': 'query3', 'body': '', 'selected': True, 'queryType': 'insert', 'joinClass': ['class3'], 'frequency': ''}, {'name': 'query4', 'body': '', 'selected': True, 'queryType': 'delete', 'joinClass': ['class1', 'class2'], 'frequency': '17'}, {'name': 'query5', 'body': '', 'selected': True, 'queryType': 'connect', 'joinClass': ['class1', 'class2'], 'frequency': '17'}]
     out={'data': [['class1', 'class2', 'class3', 'class4', 'zz', 'class5'], [0, 3, 0, 0, 0, 0], [3, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]}
     self.assertEqual(sql.get_sql_data(inp), out)
Beispiel #2
0
def sqlhandler():
    answer = ""
    try:
        requestData=h_func.convertData(request.data)
        answer = sql.get_sql_data(requestData)
    except:
        print("sql server error")
    return jsonify(answer)
def parse_requset(requestData):
    umlRequestData = requestData[0]
    umlRequestData = uml.get_uml_data(umlRequestData)
    sqlRequestData = requestData[1]
    sqlRequestData = sql.get_sql_data(sqlRequestData)
    nfrRequestData = requestData[2]
    nfrRequestData = nfr.get_nfr_data(nfrRequestData)
    weights = requestData[3]
    return umlRequestData,sqlRequestData,nfrRequestData,weights