MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / set_arguments_sqlite

Function set_arguments_sqlite

web/pgadmin/tools/debugger/__init__.py:1883–1973  ·  view source on GitHub ↗

set_arguments_sqlite(sid, did, scid, func_id) This method is responsible for setting the value of function arguments to sqlite database Parameters: sid - Server Id did - Database Id scid - Schema Id func_id - Function

(sid, did, scid, func_id)

Source from the content-addressed store, hash-verified

1881)
1882@pga_login_required
1883def set_arguments_sqlite(sid, did, scid, func_id):
1884 """
1885 set_arguments_sqlite(sid, did, scid, func_id)
1886
1887 This method is responsible for setting the value of function arguments
1888 to sqlite database
1889
1890 Parameters:
1891 sid
1892 - Server Id
1893 did
1894 - Database Id
1895 scid
1896 - Schema Id
1897 func_id
1898 - Function Id
1899 """
1900
1901 if get_server(sid) is None:
1902 return make_json_response(
1903 status=410, success=0,
1904 errormsg=gettext("Could not find the required server.")
1905 )
1906
1907 if request.data:
1908 data = json.loads(request.data)
1909
1910 try:
1911 for i in range(0, len(data)):
1912 dbg_func_args_exists = int(
1913 DebuggerFunctionArguments.query.filter_by(
1914 server_id=int(data[i]['server_id']),
1915 database_id=data[i]['database_id'],
1916 schema_id=data[i]['schema_id'],
1917 function_id=data[i]['function_id'],
1918 arg_id=data[i]['arg_id'],
1919 user_id=current_user.id).count())
1920
1921 # handle the Array list sent from the client
1922 array_string = ''
1923 if 'value' in data[i]:
1924 array_string = data[i]['value']
1925
1926 if 'is_array_value' in data[i] and 'value' in data[i] and data[i][
1927 'is_array_value']:
1928 array_string = get_array_string(data, i)
1929
1930 # Check if data is already available in database then update the
1931 # existing value otherwise add the new value
1932 if dbg_func_args_exists:
1933 dbg_func_args = DebuggerFunctionArguments.query.filter_by(
1934 server_id=int(data[i]['server_id']),
1935 database_id=data[i]['database_id'],
1936 schema_id=data[i]['schema_id'],
1937 function_id=data[i]['function_id'],
1938 arg_id=data[i]['arg_id'],
1939 user_id=current_user.id
1940 ).first()

Callers

nothing calls this directly

Calls 7

get_serverFunction · 0.90
make_json_responseFunction · 0.90
gettextFunction · 0.85
get_array_stringFunction · 0.85
firstMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected