[MAPSERVER-USERS] mssql2008 binary test package available to download

BrainDrain paulborodaev at gmail.com
Fri Oct 17 03:38:37 EDT 2008


hmm
>>could you provide an example to this
how can I help If I use mapscript?
    [WebService(Namespace = "http://www.wem.volgadmin.ru/wemlib")]
    [WebServiceBinding(ConformsTo = WsiProfiles.None)]
    [ScriptService]
    public class MapParser : System.Web.Services.WebService
    {
        [WebMethod(EnableSession = true)]
        [ScriptMethod(UseHttpGet = true)]
        public object RequestFeatureAttributes(object mapIndex, object
layerIndex, int[] featureIndexes, string[] fieldNames, bool envelope)
        {
            mapObj map;
            layerObj layer = null;
            shapeObj shape;
            int entryIndex = -1, i, j, len = featureIndexes.Length;
            object[] res = new object[len];
            Dictionary<string, object> valueBag, record;

            if (Util.isNumeric(mapIndex.ToString(), NumberStyles.Integer))
            {
                mapIndex = (object)Convert.ToInt32(mapIndex);
            }
            if (Util.isNumeric(layerIndex.ToString(), NumberStyles.Integer))
            {
                layerIndex = (object)Convert.ToInt32(layerIndex);
            }
            KeyValuePair<string, object> entry =
Util.getEntry((Dictionary<string, object>)Session["maps"],
(mapIndex.GetType() == typeof(int)) ? mapIndex :
Util.normalizePath((string)mapIndex), out entryIndex);
            map = (mapObj)entry.Value;//.clone()
            if (layerIndex.GetType() == typeof(int))
            {
                layer = map.getLayer((int)layerIndex);
            }
            else
            {
                if (layerIndex.GetType() == typeof(string))
                {
                    layer = map.getLayerByName((string)layerIndex);
                }
            }

            layer.open();
            object def;
            List<int> fieldIndexes = new List<int>();
            List<string> list = new List<string>();
            if (fieldNames != null)
            {
                for (i = 0; i < layer.numitems; i++)
                {
                    if
(((ICollection<string>)fieldNames).Contains(layer.getItem(i)))
                    {
                        fieldIndexes.Add(i);
                    }
                }
            }

            for (i = 0; i < len; i++)
            {
                try
                {
                    using (shape = layer.getFeature(featureIndexes[i], -1))
//here exception occurs
                    {

                        string[] values;

                        if (fieldNames != null)
                        {
                            if (fieldNames.Length > 0)
                            {
                                list.Clear();
                                for (j = 0; j < fieldIndexes.Count; j++)
                                {
                                    list.Add(shape.values[fieldIndexes[j]]);
                                }
                                values = list.ToArray();
                            }
                            else
                            {
                                values = new string[1] {
featureIndexes[i].ToString() };
                            }
                        }
                        else
                        {
                            values = shape.values;
                        }
                        valueBag = new Dictionary<string, object>();

                        for (j = 0; j < values.Length; j++)
                        {
                            valueBag[j.ToString()] = values[j];

                        }
                        if (envelope)
                        {
                            record = new Dictionary<string, object>();
                            if (len > 1)
                            {
                                record[featureIndexes[i].ToString()] =
(object)valueBag;//?
                            }
                            else
                            {
                                record[entryIndex.ToString() + ' ' +
layer.index.ToString() + ' ' + featureIndexes[i].ToString()] =
(object)valueBag;//?
                            }
                            res[i] = record;
                        }
                        else
                        {
                            res[i] = valueBag;
                        }
                    }
                }
                catch { }
            }
            layer.close();
            return (len > 1) ? ((envelope) ? new Dictionary<string,
object>() { { entryIndex.ToString() + ' ' + layer.index.ToString(), res } }
: (object)res) : res[0];
        }
}

Again access violation exception after modifying mapfile.
Sql profiler says that query batch (select convert(varchar(max),
STATUS),convert(varchar(max), STAGE),convert(varchar(max), id),GEOM from
dbo.Construct where id = 190748) completed successfully


Tamas Szekeres wrote:
> 
> 2008/10/16 BrainDrain <paulborodaev at gmail.com>:
>> -without "WITH(INDEX..." in mapfile data section - mem corruption
>> exception
>> on "shape = layer.getFeature(featureIndexe, -1)" after successful
>> execution
>> of queryByPoint (querying the largest polygon in my geodb);
> 
> I didn't encounter any memory corruption error here, could you provide
> an example to this?
> I've set up your database with IIS and apache with the following links:
> http://vbkto.dyndns.org:1280/cgi-bin/mapserv.exe?mode=map&map=test2008.map
> http://vbkto.dyndns.org:1080/cgi-bin/mapserv.exe?mode=map&map=test2008.map
> 
> 
>> -with using "WITH(INDEX...":
>> msMSSQL2008LayerGetShape(): Query error. Error executing MSSQL2008 SQL
>> statement: select convert(varchar(max), STATUS),convert(varchar(max),
>> STAGE),convert(varchar(max), id),GEOM from dbo.Construct
>> WITH(INDEX(SIndx_Construct_geometry_geom)) where id = 190748
>> -[Microsoft][ODBC SQL Server Driver][SQL Server]Query processor could not
>> produce a query plan because of the hints defined in this query. Resubmit
>> the query without specifying any hints and without using SET FORCEPLAN.
>> When I'm trying to execute this select statement in man. studio - error
>> message - the same.
>> I think because where clause don't contains conditions related to spatial
>> index used in 'WITH' hint.
> 
> You're right, just looking into the code here is a possible solution:
> 
> DATA "GEOM from dbo.Construct USING UNIQUE id USING SRID=0 USING INDEX
> SIndx_Construct_geometry_geom"
> 
> 
> 
> Best regards,
> 
> Tamas
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
> 

-- 
View this message in context: http://www.nabble.com/mssql2008-binary-test-package-available-to-download-tp19956347p20027820.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the mapserver-users mailing list