【发布时间】:2016-09-20 22:56:23
【问题描述】:
我有一个网络服务器,我会将用户数据添加到我的 sql 查询中。它适用于 psycopg,但不适用于 cx_Oracle。
...
class grid:
def GET(self):
web.header('Access-Control-Allow-Origin', '*')
web.header('Access-Control-Allow-Credentials', 'true')
web.header('Content-Type', 'application/json')
data = web.input(ID='')
ido = int(data.ID)
a = [ido]
cur = connection.cursor()
cur.arraysize = 10000
query = "SELECT a.id AS building_nr, c.geometry.sdo_ordinates AS geometry, d.Classname AS polygon_typ FROM building a, THEMATIC_SURFACE b, SURFACE_GEOMETRY c, OBJECTCLASS d WHERE a.id = b.BUILDING_ID AND b.LOD2_MULTI_SURFACE_ID = c.ROOT_ID AND c.GEOMETRY IS NOT NULL AND b.OBJECTCLASS_ID = d.ID AND a.grid_id_500 = %s;"
cur.execute(query, a)
它在执行语句之前一直有效。我收到错误消息: 'ascii' 编解码器无法解码位置 36 中的字节 0xfc:序数不在范围内(128)
如何将数据添加到我的查询中?
【问题讨论】: