HTTP PUT请求更新数据库中的弧,以塑造主体,“中心”点

问题描述 投票:0回答:1

我正在尝试发送PUT请求以更新数据库中的ARC行。该表的列如下:

id_shape是integer,中心是point,半径,start_angle,end_angle的类型是[[double precision,ccw是character changes

我的请求正文如下:

String arcCenter = xStr + ',' + yStr; String arcRadius = globals.pArcs[globals.selectedArcIndex].r.toString(); String arcStartAngle = globals.pArcs[globals.selectedArcIndex].startAngle.toString(); String arcEndAngle = globals.pArcs[globals.selectedArcIndex].endAngle.toString(); String arcCCW = globals.pArcs[globals.selectedArcIndex].ccw ? '\"t\"' : '\"f\"'; data = { 'id_shape': globals.selectedShapeID.toString(), 'center': { 'x': xStr, 'y': yStr, }, 'radius': arcRadius, 'start_angle': arcStartAngle, 'end_angle': arcEndAngle, 'ccw': arcCCW, };

结果,我遇到以下错误:

invalid input syntax for type point: "{"id_shape":"3","center":{"x":"0.0","y":"893.025403784439"},"radius":"600.0","start_angle":"110.0","end_angle":"50.0","ccw":"\"f\""}"

我认为这与尝试设置

center

的尝试有关。如何形成POINT类型的字符串?提前感谢。
database http put point
1个回答
0
投票
这是我的坏事。在服务器端,我的功能签名有问题。同事的更新功能是将参数(而不是整个形状信息)作为json主体一个接一个地获取,并迭代其元素以进行数据库插入。该修补程序针对可能需要的人如下:

modify_arc : async function(id_shape, info_shape){ center = info_shape['center']; radius = info_shape['radius']; startAngle = info_shape['startAngle']; endAngle = info_shape['endAngle']; ccw = info_shape['ccw']; const result = await send_query("UPDATE arc SET center = $2, radius = $3, " + "start_angle = $4, end_angle = $5, ccw = $6 WHERE id_shape = $1", [id_shape, center, radius, startAngle, endAngle, ccw]); return(result); },

© www.soinside.com 2019 - 2024. All rights reserved.