24 lines
735 B
Python
24 lines
735 B
Python
from .operation import *
|
|
|
|
|
|
def get_title_schema(name: str) -> dict[str, dict[str, Any]]:
|
|
return {'value': {'type': 'float', 'optional': False, 'readonly': False}}
|
|
|
|
|
|
def get_title(name: str) -> dict[str, Any]:
|
|
title = read(name, 'select * from title')
|
|
return { 'value': title['value'] }
|
|
|
|
|
|
def set_title(name: str, cs: ChangeSet) -> ChangeSet:
|
|
new = cs.operations[0]['value']
|
|
old = get_title(name)['value']
|
|
|
|
redo_sql = f"update title set value = '{new}';"
|
|
undo_sql = f"update title set value = '{old}';"
|
|
|
|
redo_cs = g_update_prefix | { 'type': 'title', 'value': new }
|
|
undo_cs = g_update_prefix | { 'type': 'title', 'value': old }
|
|
|
|
return execute_command(name, redo_sql, undo_sql, redo_cs, undo_cs)
|