MCPcopy Create free account
hub / github.com/MapServer/MapServer / msMSSQL2008LayerWhichShapes

Function msMSSQL2008LayerWhichShapes

mapmssql2008.c:682–720  ·  view source on GitHub ↗

Execute SQL query for this layer */

Source from the content-addressed store, hash-verified

680
681/* Execute SQL query for this layer */
682int msMSSQL2008LayerWhichShapes(layerObj *layer, rectObj rect, int isQuery)
683{
684 msMSSQL2008LayerInfo *layerinfo = 0;
685 char *query_str = 0;
686 int set_up_result;
687
688 if(layer->debug) {
689 msDebug("msMSSQL2008LayerWhichShapes called\n");
690 }
691
692 layerinfo = getMSSQL2008LayerInfo(layer);
693
694 if(!layerinfo) {
695 /* layer not opened yet */
696 msSetError(MS_QUERYERR, "msMSSQL2008LayerWhichShapes called on unopened layer (layerinfo = NULL)", "msMSSQL2008LayerWhichShapes()");
697
698 return MS_FAILURE;
699 }
700
701 if(!layer->data) {
702 msSetError(MS_QUERYERR, "Missing DATA clause in MSSQL2008 Layer definition. DATA statement must contain 'geometry_column from table_name' or 'geometry_column from (sub-query) as foo'.", "msMSSQL2008LayerWhichShapes()");
703
704 return MS_FAILURE;
705 }
706
707 set_up_result = prepare_database(layer, rect, &query_str);
708
709 if(set_up_result != MS_SUCCESS) {
710 msFree(query_str);
711
712 return set_up_result; /* relay error */
713 }
714
715 msFree(layerinfo->sql);
716 layerinfo->sql = query_str;
717 layerinfo->row_num = 0;
718
719 return MS_SUCCESS;
720}
721
722/* Close the MSSQL2008 record set and connection */
723int msMSSQL2008LayerClose(layerObj *layer)

Callers

nothing calls this directly

Calls 5

msDebugFunction · 0.85
getMSSQL2008LayerInfoFunction · 0.85
msSetErrorFunction · 0.85
prepare_databaseFunction · 0.85
msFreeFunction · 0.85

Tested by

no test coverage detected