(connection, interface_id, arg:Arg, order)
| 84 | |
| 85 | |
| 86 | def insert_update_arg(connection, interface_id, arg:Arg, order): |
| 87 | try: |
| 88 | arg_existing = get_arg(connection, interface_id, order) |
| 89 | if arg_existing is None: |
| 90 | arg_id = insert_arg(connection, interface_id, order) |
| 91 | return arg_id |
| 92 | else: |
| 93 | cursor = connection.cursor() |
| 94 | update_query = """UPDATE arg SET interface_id = ?, |
| 95 | ordering = ?, |
| 96 | type = ?, info = ?, constr = ?, |
| 97 | where id = ? |
| 98 | """ |
| 99 | cursor.execute(update_query, interface_id, order, |
| 100 | arg.argtype, "", "", arg_existing.db_id) |
| 101 | connection.commit() |
| 102 | cursor.close() |
| 103 | return arg.db_id |
| 104 | except Exception as e: |
| 105 | logging.error(f'[BINDERDB] Failed insert/update of service{str(e)}, {traceback.format_exc()}') |
| 106 | print(f'[BINDERDB] Failed insert/update of service {str(e)}, {traceback.format_exc()}') |
| 107 | |
| 108 | def get_arg(connection, interface_id, ordering): |
| 109 | try: |
no test coverage detected