Exemplo n.º 1
0
		public static SpatialColumnInfo GetColumnInfo(SQLiteConnection connection, string tableName, string columnName, string database = "main")
		{
			var cmd = connection.CreateCommand();
			cmd.CommandText = "SELECT f_table_name, f_geometry_column, type, coord_dimension, srid, spatial_index_enabled FROM " + database + ".geometry_columns WHERE UPPER(f_table_name) = @tablename AND UPPER(f_geometry_column) = @columnName";
			cmd.Parameters.Add("tableName", System.Data.DbType.String).Value = tableName.ToUpper();
			cmd.Parameters.Add("columnName", System.Data.DbType.String).Value = columnName.ToUpper();

			foreach (var row in SqliteUtil.GetRows(cmd))
			{
				var info = new SpatialColumnInfo();
				info.TableName = (string)row[0];
				info.ColumnName = (string)row[1];
				info.Type = (string)row[2];
				info.Dimension = row[3] is string ? ((string)row[3]).Length : Convert.ToInt32(row[3]);
				info.SRID = Convert.ToInt32(row[4]);
				info.SpatialIndex = (SpatialIndexMode)Convert.ToInt32(row[5]);
				return info;
			}
			return null;
		}
Exemplo n.º 2
0
 private void AddRow(SpatialColumnInfo spatialColumnInfo)
 {
     var item = lvwTables.Items.Add(spatialColumnInfo.TableName);
     item.SubItems.Add(spatialColumnInfo.ColumnName);
     item.SubItems.Add(spatialColumnInfo.Type);
     item.SubItems.Add(spatialColumnInfo.SRID.ToString());
     item.SubItems.Add(spatialColumnInfo.SpatialIndex.ToString());
     item.Tag = spatialColumnInfo;
 }