Example #1
0
def work_add():
    #args/input
    args = request.form
    name = args['name']
    content = args['content']

    myDB = WEBDB(dbfile, {'logging': 'on', 'type': 'sqlite'})

    #add to table_content
    content_id = myDB.insertQueryBlob(
        'INSERT INTO table_content (content_blob) VALUES (?)', content)
    print(content_id)

    #add to table_work
    sql_work_insert = """
    INSERT INTO table_work (name, content_id, createdate, lastdate, active) 
    VALUES (
    \'""" + name + """\', 
    """ + str(content_id) + """, 
    datetime(\'now\'), 
    datetime(\'now\'),
    1
    )
    """
    work_id = myDB.insertQuery(sql_work_insert)
    return json.dumps([])
Example #2
0
def work_update(id):
    args = request.form
    name = args['name']
    content = args['content']

    myDB = WEBDB(dbfile, {'logging': 'on', 'type': 'sqlite'})

    #update to table_content
    myDB.updateQueryBlob(
        'UPDATE table_content SET content_blob=(?) WHERE id=' + str(id),
        content)

    #update to table_work
    sql_work_update = """
    UPDATE table_work
    SET name ='""" + name + """',
    lastdate=datetime(\'now\')
    WHERE id = """ + str(id) + """
    """
    work_id = myDB.insertQuery(sql_work_update)
    return json.dumps([])