File tree Expand file tree Collapse file tree 3 files changed +61
-1
lines changed
LinqToDBPostGisNetTopologySuite.Tests
LinqToDBPostGisNetTopologySuite Expand file tree Collapse file tree 3 files changed +61
-1
lines changed Original file line number Diff line number Diff line change @@ -346,7 +346,10 @@ public void TestSTReducePrecision()
346
346
{
347
347
// TODO: ? Some helper version classes / attributes for methods?
348
348
var version = new Version ( db . Select ( ( ) => VersionFunctions . PostGISLibVersion ( ) ) ) ;
349
- if ( version >= new Version ( "3.1.0" ) ) // TODO: ? const
349
+ var geos = db . Select ( ( ) => VersionFunctions . PostGISGEOSVersion ( ) ) ;
350
+ var geosVersion = geos != null ? new Version ( geos . Substring ( 0 , geos . IndexOf ( '-' ) ) ) : null ;
351
+
352
+ if ( ( version >= new Version ( "3.1.0" ) ) && ( geosVersion != null ) && ( geosVersion >= new Version ( "3.9" ) ) ) // TODO: ? const
350
353
{
351
354
const string Wkt = "POINT(1.412 19.323)" ;
352
355
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Linq ;
3
+
4
+ using LinqToDB ;
5
+ using NUnit . Framework ;
6
+
7
+ namespace LinqToDBPostGisNetTopologySuite . Tests
8
+ {
9
+ [ TestFixture ]
10
+ class VersionFunctionsTests : TestsBase
11
+ {
12
+ [ Test ]
13
+ public void TestPostGISFullVersion ( )
14
+ {
15
+ using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
16
+ {
17
+ var fullVersion = db . Select ( ( ) => VersionFunctions . PostGISFullVersion ( ) ) ;
18
+ Assert . IsNotNull ( fullVersion ) ;
19
+
20
+ // Just to see in test runner output
21
+ Console . WriteLine ( new String ( '-' , 40 ) ) ;
22
+ Console . WriteLine ( fullVersion ) ;
23
+ Console . WriteLine ( new String ( '-' , 40 ) ) ;
24
+ }
25
+ }
26
+ }
27
+ }
Original file line number Diff line number Diff line change @@ -12,6 +12,36 @@ namespace LinqToDBPostGisNetTopologySuite
12
12
/// </remarks>
13
13
public static class VersionFunctions
14
14
{
15
+ /// <summary>
16
+ /// Returns full PostGIS version and build configuration information.
17
+ /// </summary>
18
+ /// <remarks>
19
+ /// See https://postgis.net/docs/PostGIS_Full_Version.html
20
+ /// </remarks>
21
+ /// <returns>
22
+ /// Full PostGIS version and build configuration information.
23
+ /// </returns>
24
+ [ Sql . Function ( "PostGIS_Full_Version" , ServerSideOnly = true ) ]
25
+ public static string PostGISFullVersion ( )
26
+ {
27
+ throw new InvalidOperationException ( ) ;
28
+ }
29
+
30
+ /// <summary>
31
+ /// Returns the version number of the GEOS library, or null if GEOS support is not enabled.
32
+ /// </summary>
33
+ /// <remarks>
34
+ /// See https://postgis.net/docs/PostGIS_GEOS_Version.html
35
+ /// </remarks>
36
+ /// <returns>
37
+ /// Version number of the GEOS library.
38
+ /// </returns>
39
+ [ Sql . Function ( "PostGIS_GEOS_Version" , ServerSideOnly = true ) ]
40
+ public static string PostGISGEOSVersion ( )
41
+ {
42
+ throw new InvalidOperationException ( ) ;
43
+ }
44
+
15
45
/// <summary>
16
46
/// Returns the version number of the PostGIS library.
17
47
/// </summary>
You can’t perform that action at this time.
0 commit comments