Accessing geometric values from embedded SQL
От | Tony Griffiths |
---|---|
Тема | Accessing geometric values from embedded SQL |
Дата | |
Msg-id | 3D1B3C98.8E59BF04@cs.man.ac.uk обсуждение исходный текст |
Список | pgsql-novice |
Hi, I'm really stuck with this one, so any help greatly appreciated.... If I create a table BBoxes with the definition: create table BBoxes( bbox box ); that is suitably initialised with boxes, then issue the following sql embedded in C: EXEC SQL BEGIN DECLARE SECTION; char ret_bbox[500]; EXEC SQL END DECLARE SECTION; strcpy(query_string, "(1,1),(5,5)"); EXEC SQL DECLARE bbox_curs CURSOR FOR SELECT bbox FROM BBoxes; exec sql whenever not found do break; EXEC SQL OPEN bbox_overlaps_curs; for(;;) { EXEC SQL FETCH bbox_overlaps_curs into :ret_bbox; } I get the following problems: 1) ret_bbox always contains an empty string 2) the fetch operation's sqlca.sqlcode always is -211 (DATA_NOT_ARRAY) I've also tried (in desperation) declaring the cursor as: EXEC SQL DECLARE bbox_curs CURSOR FOR SELECT box(bbox) FROM BBoxes; I've also (again in desperation) tried the following: exec sql type POINT is struct { double x; double y; }; exec sql type BOX is struct { POINT high; POINT low; }; EXEC SQL BEGIN DECLARE SECTION; BOX ret_bbox; EXEC SQL END DECLARE SECTION; with the same code, and still get the -211 error, and the fields of ret_bbox, containing gibberish. Any ideas about how to do this, or how to do this with ADTs in general would be appreciated. Many thanks, -- Tony --------------------------------- Dr. Tony Griffiths Research Fellow Information Management Group, Department of Computer Science, The University of Manchester, Oxford Road, Manchester M13 9PL, United Kingdom Tel. +44 (0) 161 275 6139 Fax +44 (0) 161 275 6236 email tony.griffiths@cs.man.ac.uk ---------------------------------
В списке pgsql-novice по дате отправления: