Skip to content

Commit a066a72

Browse files
committed
Implemented full set of Version Functions
1 parent 4882c00 commit a066a72

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed

LinqToDBPostGisNetTopologySuite.Tests/VersionFunctionsTests.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,42 @@ public void TestPostGISFullVersion()
2121
Console.WriteLine(new String('-', 40));
2222
Console.WriteLine(fullVersion);
2323
Console.WriteLine(new String('-', 40));
24+
25+
var geosVersion = db.Select(() => VersionFunctions.PostGISGEOSVersion());
26+
Console.WriteLine($"GEOS={geosVersion}");
27+
28+
var liblwgeomVersion = db.Select(() => VersionFunctions.PostGISLiblwgeomVersion());
29+
Console.WriteLine($"liblwgeom={liblwgeomVersion}");
30+
31+
var libXmlVersion = db.Select(() => VersionFunctions.PostGISLibXMLVersion());
32+
Console.WriteLine($"LibXML={libXmlVersion}");
33+
34+
var libBuildDate = db.Select(() => VersionFunctions.PostGISLibBuildDate());
35+
Console.WriteLine($"PostGIS lib build date={libBuildDate}");
36+
37+
var libVersion = db.Select(() => VersionFunctions.PostGISLibVersion());
38+
Console.WriteLine($"PostGIS lib version={libVersion}");
39+
40+
var projVersion = db.Select(() => VersionFunctions.PostGISPROJVersion());
41+
Console.WriteLine($"PROJ4={projVersion}");
42+
43+
var currentVersion = new Version(db.Select(() => VersionFunctions.PostGISLibVersion()));
44+
if (currentVersion >= new Version("3.0"))
45+
{
46+
var wagyuVersion = db.Select(() => VersionFunctions.PostGISWagyuVersion());
47+
Console.WriteLine($"Wagyu={wagyuVersion}");
48+
}
49+
50+
var scriptsBuildDate = db.Select(() => VersionFunctions.PostGISScriptsBuildDate());
51+
Console.WriteLine($"PostGIS scripts build date={scriptsBuildDate}");
52+
53+
var scripts = db.Select(() => VersionFunctions.PostGISScriptsInstalled());
54+
Console.WriteLine($"PostGIS scripts={scripts}");
55+
56+
var postGisVersion = db.Select(() => VersionFunctions.PostGISVersion());
57+
Console.WriteLine($"PostGIS version={postGisVersion}");
58+
59+
Console.WriteLine(new String('-', 40));
2460
}
2561
}
2662
}

LinqToDBPostGisNetTopologySuite/VersionFunctions.cs

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,51 @@ public static string PostGISGEOSVersion()
4242
throw new InvalidOperationException();
4343
}
4444

45+
/// <summary>
46+
/// Returns the version number of the liblwgeom library.
47+
/// </summary>
48+
/// <remarks>
49+
/// See https://postgis.net/docs/PostGIS_Liblwgeom_Version.html
50+
/// </remarks>
51+
/// <returns>
52+
/// Version number of the liblwgeom library.
53+
/// </returns>
54+
[Sql.Function("PostGIS_Liblwgeom_Version", ServerSideOnly = true)]
55+
public static string PostGISLiblwgeomVersion()
56+
{
57+
throw new InvalidOperationException();
58+
}
59+
60+
/// <summary>
61+
/// Returns the version number of the libxml library.
62+
/// </summary>
63+
/// <remarks>
64+
/// See https://postgis.net/docs/PostGIS_LibXML_Version.html
65+
/// </remarks>
66+
/// <returns>
67+
/// Version number of the libxml library.
68+
/// </returns>
69+
[Sql.Function("PostGIS_LibXML_Version", ServerSideOnly = true)]
70+
public static string PostGISLibXMLVersion()
71+
{
72+
throw new InvalidOperationException();
73+
}
74+
75+
/// <summary>
76+
/// Returns the build date of the PostGIS library.
77+
/// </summary>
78+
/// <remarks>
79+
/// See https://postgis.net/docs/PostGIS_Lib_Build_Date.html
80+
/// </remarks>
81+
/// <returns>
82+
/// Build date of the PostGIS library.
83+
/// </returns>
84+
[Sql.Function("PostGIS_Lib_Build_Date", ServerSideOnly = true)]
85+
public static string PostGISLibBuildDate()
86+
{
87+
throw new InvalidOperationException();
88+
}
89+
4590
/// <summary>
4691
/// Returns the version number of the PostGIS library.
4792
/// </summary>
@@ -57,6 +102,66 @@ public static string PostGISLibVersion()
57102
throw new InvalidOperationException();
58103
}
59104

105+
/// <summary>
106+
/// Returns the version number of the PROJ4 library, or null if PROJ4 support is not enabled.
107+
/// </summary>
108+
/// <remarks>
109+
/// See https://postgis.net/docs/PostGIS_PROJ_Version.html
110+
/// </remarks>
111+
/// <returns>
112+
/// Version number of the PROJ4 library.
113+
/// </returns>
114+
[Sql.Function("PostGIS_PROJ_Version", ServerSideOnly = true)]
115+
public static string PostGISPROJVersion()
116+
{
117+
throw new InvalidOperationException();
118+
}
119+
120+
/// <summary>
121+
/// Returns the version number of the internal Wagyu library, or null if Wagyu support is not enabled.
122+
/// </summary>
123+
/// <remarks>
124+
/// See https://postgis.net/docs/PostGIS_Wagyu_Version.html
125+
/// </remarks>
126+
/// <returns>
127+
/// Version number of the Wagyu library.
128+
/// </returns>
129+
[Sql.Function("PostGIS_Wagyu_Version", ServerSideOnly = true)]
130+
public static string PostGISWagyuVersion()
131+
{
132+
throw new InvalidOperationException();
133+
}
134+
135+
/// <summary>
136+
/// Returns the build date of the PostGIS scripts.
137+
/// </summary>
138+
/// <remarks>
139+
/// See https://postgis.net/docs/PostGIS_Scripts_Build_Date.html
140+
/// </remarks>
141+
/// <returns>
142+
/// Build date of the PostGIS scripts.
143+
/// </returns>
144+
[Sql.Function("PostGIS_Scripts_Build_Date", ServerSideOnly = true)]
145+
public static string PostGISScriptsBuildDate()
146+
{
147+
throw new InvalidOperationException();
148+
}
149+
150+
/// <summary>
151+
/// Returns version of the PostGIS scripts installed in this database.
152+
/// </summary>
153+
/// <remarks>
154+
/// See https://postgis.net/docs/PostGIS_Scripts_Installed.html
155+
/// </remarks>
156+
/// <returns>
157+
/// Version of the PostGIS scripts.
158+
/// </returns>
159+
[Sql.Function("PostGIS_Scripts_Installed", ServerSideOnly = true)]
160+
public static string PostGISScriptsInstalled()
161+
{
162+
throw new InvalidOperationException();
163+
}
164+
60165
/// <summary>
61166
/// Returns PostGIS version number and compile-time options.
62167
/// </summary>

0 commit comments

Comments
 (0)