2424
2525using FirebirdSql . Data . FirebirdClient ;
2626using FirebirdSql . Data . Common ;
27+ using FirebirdSql . Data . Services ;
2728
2829namespace FirebirdSql . Data . Schema
2930{
3031#warning New datatypes
3132
3233 internal abstract class FbSchema
3334 {
34- #region Constructors
35-
36- public FbSchema ( )
37- {
38- }
39-
40- #endregion
41-
4235 #region Abstract Methods
4336
4437 protected abstract StringBuilder GetCommandText ( string [ ] restrictions ) ;
@@ -74,6 +67,7 @@ public DataTable GetSchema(FbConnection connection, string collectionName, strin
7467
7568 protected FbCommand BuildCommand ( FbConnection connection , string collectionName , string [ ] restrictions )
7669 {
70+ SetMajorVersionNumber ( connection ) ;
7771 var filter = string . Format ( "CollectionName='{0}'" , collectionName ) ;
7872 var builder = GetCommandText ( restrictions ) ;
7973 var restriction = connection . GetSchema ( DbMetaDataCollectionNames . Restrictions ) . Select ( filter ) ;
@@ -103,6 +97,7 @@ protected FbCommand BuildCommand(FbConnection connection, string collectionName,
10397 return command ;
10498 }
10599
100+
106101 protected virtual DataTable ProcessResult ( DataTable schema )
107102 {
108103 return schema ;
@@ -115,6 +110,19 @@ protected virtual string[] ParseRestrictions(string[] restrictions)
115110
116111 #endregion
117112
113+ #region Private Methods
114+ /// <summary>
115+ /// Determines the major version number from the Serverversion on the inner connection.
116+ /// </summary>
117+ /// <param name="connection">an open connection, which is used to determine the version number of the connected database server</param>
118+ private void SetMajorVersionNumber ( FbConnection connection )
119+ {
120+ var serverVersion = FbServerProperties . ParseServerVersion ( connection . ServerVersion ) ;
121+ MajorVersionNumber = serverVersion . Major ;
122+ }
123+ #endregion
124+
125+
118126 #region Private Static Methods
119127
120128 private static void TrimStringFields ( DataTable schema )
@@ -138,5 +146,12 @@ private static void TrimStringFields(DataTable schema)
138146 }
139147
140148 #endregion
149+
150+ #region Properties
151+ /// <summary>
152+ /// The major version of the connected Firebird server
153+ /// </summary>
154+ protected int MajorVersionNumber { get ; private set ; }
155+ #endregion
141156 }
142157}
0 commit comments