RE: Use Datablade API with spatial datablade?
Posted in 2012
Hi Mike,
I noticed that you have set the length of this parameter value to 0 with:
lengths[0] = 0;
Although you have set the length of the mi_lvarchar value with
mi_set_varlen(lvvar,lot_wkb_len);
the length value of that parameter to mi_exec_prepared_statement() should
also be set to the same length:
lengths[0] = lot_wkb_len;
Hope this helps.
-- Mark
Mark Ashworth
IBM/Informix Extensibility Architect
Email: ashworth@ca.ibm.com
-----Original Message-----
From: spatial-users-bounces@iiug.org [mailto:spatial-users-bounces@iiug.org]
On Behalf Of MIKE DUNHAM-WILKIE
Sent: May 26, 2012 11:24 AM
To: spatial-users@iiug.org
Subject: Use Datablade API with spatial datablade? [14]
I've been trying to upload geometry to an st_geometry column using the
datablade api.
I set my mi_lvarchar variable lvvar using
geom_to_wkb (&geom, &max_alloced, &lot_wkb_len, &lot_wkb_buf);
lvvar = mi_new_var(lot_wkb_len);
mi_set_varlen(lvvar,lot_wkb_len);
mi_set_vardata(lvvar,lot_wkb_buf);
(where geom_to_wkb is as in the spatial datablade example code)
I then do prepare the statement:
insert into table(linework,id) values(st_geomfromwkb(?,15),?);
and set:
numTypes = 2
values[0] = lvvar;
types[0] = "lvarchar";
nulls[0] = MI_FALSE;
lengths[0] = 0;
(and set values[1], etc.)
I get the error:
ERROR: USE44 XUSE44:-937:Unknown OGIS WKB byte-order byte encountered in
ST_GeomFromWKB. while executing statement <no query text>
when I execute the prepared statement:
mi_exec_prepared_statement(statement, MI_SEND_READ, 1,
numTypes,
values, lengths, nulls, types, 0, 0)
However, I when I do an mi_get_vardata on the mi_lvarchar that I'm passing
up
(lvvar) and inspect the binary contents, I get:
length is 98
swap_bytes is 0
wkb_type is 5
nlines is 1
swap_bytes is 0 (for first line)
wkb_type is 2 (for first line)
....
Both swap_bytes appear to be correct.
Thanks for any help you can provide.
Mike Dunham-Wilkie
****************************************************************************
***
Forum Note: Use "Reply" to post a response in the discussion forum.