【发布时间】:2019-09-06 08:46:36
【问题描述】:
我有这个代码。
const char * q = "INSERT INTO test_raster (raw_data) VALUES
(ST_SetValues(ST_AddBand(ST_MakeEmptyRaster(2, 2, -180, -90, 180, -90, 0, 0, 4326),
1, '8BUI', 0, 0), 1, 1, 1, $1::double precision[][]))";
double tmp[2][2] = { {0, 125}, {45, 255} };
const char *values[1] = { (char *)&tmp };
int lengths[1] = { 4*sizeof(double) };
int binary[1] = { 1 };
PGresult *rs = PQexecParams(psql,
q,
1,
NULL,
values,
lengths,
binary,
0);
auto stat = PQresultStatus(rs);
printf("%s", PQresultErrorMessage(rs));
psql 是通过 PostGIS 连接到 PostgreSQL。但是,当我运行这段代码时,我得到了"ERROR: wrong element type"
这是什么原因造成的? OID应该由数据库从指定的::double precision[][]推导出来
【问题讨论】:
标签: c postgresql postgis