Fetching Spatial Data •Perform the conversion directly in the  INSERT  statement: •Perform the conversion prior to the  INSERT : •Inserting a  POINT(1 1)  value with hex literal syntax: •An ODBC application can send a WKB representation, binding it to a placeholder using an argument of BLOB  type: Other programming interfaces may support a similar placeholder mechanism. A client application program that wants to use WKB representations of geometry values is responsible for sending correctly formed WKB in queries to the server. There are several ways to satisfy this requirement. For example: The preceding examples use  ST_GeomFromText()  to create geometry values. You can also use type- specific functions: The following examples insert more complex geometries into the table: INSERT INTO geom VALUES (ST_GeomFromText(’POINT(1 1)’)); SET @g = ’POINT(1 1)’; INSERT INTO geom VALUES (ST_GeomFromText(@g)); SET @g = ST_GeomFromText(’POINT(1 1)’); INSERT INTO geom VALUES (@g); SET @g = ’LINESTRING(0 0,1 1,2 2)’; INSERT INTO geom VALUES (ST_GeomFromText(@g)); SET @g = ’POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))’; INSERT INTO geom VALUES (ST_GeomFromText(@g)); SET @g = ’GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))’; INSERT INTO geom VALUES (ST_GeomFromText(@g)); SET @g = ’POINT(1 1)’; INSERT INTO geom VALUES (ST_PointFromText(@g)); SET @g = ’LINESTRING(0 0,1 1,2 2)’; INSERT INTO geom VALUES (ST_LineStringFromText(@g)); SET @g = ’POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))’; INSERT INTO geom VALUES (ST_PolygonFromText(@g)); SET @g = ’GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))’; INSERT INTO geom VALUES (ST_GeomCollFromText(@g)); INSERT INTO geom VALUES (ST_GeomFromWKB(X’0101000000000000000000F03F000000000000F03F’)); INSERT INTO geom VALUES (ST_GeomFromWKB(?)) 11.4.8 Fetching Spatial Data 2063 Geometry values stored in a table can be fetched in internal format. You can also convert them to WKT or WKB format. •In a C program, you can escape a binary value using  mysql_real_escape_string_quote()  and include the result in a query string that is sent to the server. See mysql_real_escape_string_quote().