Skip to content

Commit eb1b5ea

Browse files
committed
fix: generate missing values for geometry columns
Refs #2009
1 parent 173efeb commit eb1b5ea

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

source/tabletools.pas

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2295,6 +2295,12 @@ procedure TfrmTableTools.DoGenerateData(DBObj: TDBObject);
22952295
TextVal: String;
22962296
BinVal: String;
22972297
NumRows, NullsAmount: Int64;
2298+
2299+
function RS: String;
2300+
begin
2301+
// return a Random integer as String
2302+
Result := RandomRange(1, 100).ToString;
2303+
end;
22982304
begin
22992305
// Generate rows
23002306
if not (DBObj.NodeType in [lntTable, lntView]) then begin
@@ -2440,7 +2446,20 @@ procedure TfrmTableTools.DoGenerateData(DBObj: TDBObject);
24402446
Values.Add(Col.Connection.EscapeString(TextVal));
24412447
end;
24422448

2443-
dtcSpatial: ;
2449+
dtcSpatial: begin
2450+
TextVal := Col.Connection.EscapeString('');
2451+
case Col.DataType.Index of
2452+
dbdtPoint: TextVal := 'POINT('+RS+', '+RS+')';
2453+
dbdtMultipoint: TextVal := 'MULTIPOINT(POINT('+RS+', '+RS+'), POINT('+RS+', '+RS+'))';
2454+
dbdtLinestring: TextVal := 'LINESTRING(POINT('+RS+', '+RS+'), POINT('+RS+', '+RS+'))';
2455+
dbdtMultilinestring: TextVal := 'MULTILINESTRING(LINESTRING(POINT('+RS+', '+RS+'), POINT('+RS+', '+RS+')), LINESTRING(POINT('+RS+', '+RS+'), POINT('+RS+', '+RS+')))';
2456+
dbdtPolygon: TextVal := 'POLYGON(LINESTRING(POINT('+RS+', '+RS+'), POINT('+RS+', '+RS+')), LINESTRING(POINT('+RS+', '+RS+'), POINT('+RS+', '+RS+')))';
2457+
dbdtMultipolygon: TextVal := 'MULTIPOLYGON(POLYGON(LINESTRING(POINT('+RS+', '+RS+'), POINT('+RS+', '+RS+')), LINESTRING(POINT('+RS+', '+RS+'), POINT('+RS+', '+RS+'))))';
2458+
dbdtGeometry: TextVal := 'POINT('+RS+', '+RS+')';
2459+
dbdtGeometrycollection: TextVal := 'GEOMETRYCOLLECTION(POINT('+RS+', '+RS+'), LINESTRING(POINT('+RS+', '+RS+'), POINT('+RS+', '+RS+')))';
2460+
end;
2461+
Values.Add(TextVal);
2462+
end;
24442463

24452464
dtcOther: begin
24462465
case Col.DataType.Index of

0 commit comments

Comments
 (0)