Пример #1
0
def selectPanel():
    """detect the table which is to be selected"""
    global table
    table = request.form['table']
    sql = SQL_Server()
    # detect if the table is in db
    if not sql.tableDetect(table):
        # exceptions.BadRequestKeyError here
        return redirect('/developer')
    attributeList = sql.getAttributeListOfTable(table)
    return render_template('developer_select.html',
                           table=table,
                           attributeList=attributeList,
                           attributeLen=len(attributeList))
Пример #2
0
def userInsertPanel():
    """detect the table which is to be inserted"""
    global table
    table = request.form['table']
    sql = SQL_Server()
    # detect if the table is in db
    if not sql.tableDetect(table):
        # exceptions.BadRequestKeyError here
        return redirect('/developer')
    attribute = '*'
    results = sql.selectFromTable(table, attribute)
    attributeList = sql.getAttributeListOfTable(table)
    if len(results) != 0:
        col = len(results[0])
    else:
        col = 0
    return render_template('user_insert.html',
                           table=table,
                           attributeList=attributeList,
                           results=results,
                           attribute=attribute,
                           row=len(results),
                           col=col,
                           attributeLen=len(attributeList))