Hi,
Unfortunately, Rose is right. I ran into the same issue, while checking out something else. It doesn’t really hurt, but potentially slows down table-lookups, as all the geographic information has to be put through twice.
In my case it revealed something else which is a little bit sad: when requesting single values for a certain column using the querytools, you have to retrieve all columns, or maybe you should assemble the collection of columns that you want to retrieve manually, which is a cumbersome process, way to difficult. Choosing which columns to retrieve should be based on a simple collection of strings.
In my case, I would probably write all SQL from sratch myself, when retrieving specific single pieces of information (single value lookup, or single rows), which is not too hard. Something like this:
'Build the query string (contains a local function to get the map X and Y coordinates with a little less code)
'Also insert the columnname and the SRID. As you can see, it’s not even neccessary to retrieve the geometry data or keyvalues!
Dim sSQL As String
sSQL = String.Format("select {0} from nl.vw_adm_gem_2008 " & _
“where GeomFromText(‘POINT({1} {2})’,{3}) && the_geom;”, _
Chr(34) & “GEMNM” & Chr(34), CType(Me.GetGeoPt(e.X, e.Y).X, Int32), CType(Me.GetGeoPt(e.X, e.Y).Y, Int32), 28992)
'finally perform a ExecuteScalar.
TextBox1.AppendText(postcode.QueryTools.ExecuteScalar(sSQL))
This is really fast for single value lookups, for entire rows you’ll need ExecuteQuery. Maybe I’ll even get around it completely, and use only the featureid and get all tabledata in another way. As a matter of fact, it would be better to use prepared statements and paramaters instead of putting together the SQL this way (mainly because of protection against SQL-injection), but if your applications manages it well, this can be safe too.
As said before, retrieving too many columns, or even twice, does not hurt, but when many people are using the same database, or when working with large tables, it could become important that MapSuite optimizes it queries.
So, this is definitely a point for improvements in upcoming releases.
Regards,
Wouter