2 * Firebird ADO.NET Data provider for .NET and Mono
4 * The contents of this file are subject to the Initial
5 * Developer's Public License Version 1.0 (the "License");
6 * you may not use this file except in compliance with the
7 * License. You may obtain a copy of the License at
8 * http://www.firebirdsql.org/index.php?op=doc&id=idpl
10 * Software distributed under the License is distributed on
11 * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
12 * express or implied. See the License for the specific
13 * language governing rights and limitations under the License.
15 * Copyright (c) 2002, 2005 Carlos Guzman Alvarez
16 * All Rights Reserved.
20 using System.Collections;
22 using FirebirdSql.Data.Common;
24 namespace FirebirdSql.Data.Firebird.Services
26 /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/overview/*'/>
27 public sealed class FbServerProperties : FbService
31 /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="Version"]/*'/>
34 get { return this.GetInt32(IscCodes.isc_info_svc_version); }
37 /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="ServerVersion"]/*'/>
38 public string ServerVersion
40 get { return this.GetString(IscCodes.isc_info_svc_server_version); }
43 /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="Implementation"]/*'/>
44 public string Implementation
46 get { return this.GetString(IscCodes.isc_info_svc_implementation); }
49 /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="RootDirectory"]/*'/>
50 public string RootDirectory
52 get { return this.GetString(IscCodes.isc_info_svc_get_env); }
55 /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="LockManager"]/*'/>
56 public string LockManager
58 get { return this.GetString(IscCodes.isc_info_svc_get_env_lock); }
61 /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="MessageFile"]/*'/>
62 public string MessageFile
64 get { return this.GetString(IscCodes.isc_info_svc_get_env_msg); }
67 /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="DatabasesInfo"]/*'/>
68 public FbDatabasesInfo DatabasesInfo
72 ArrayList info = this.GetInfo(IscCodes.isc_info_svc_svr_db_info);
74 return info.Count != 0 ? (FbDatabasesInfo)info[0] : new FbDatabasesInfo();
78 /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/property[@name="ServerConfig"]/*'/>
79 public FbServerConfig ServerConfig
83 ArrayList info = this.GetInfo(IscCodes.isc_info_svc_get_config);
85 return info.Count != 0 ? (FbServerConfig)info[0] : new FbServerConfig();
93 /// <include file='Doc/en_EN/FbServerProperties.xml' path='doc/class[@name="FbServerProperties"]/constructor[@name="FbServerProperties"]/*'/>
94 public FbServerProperties() : base()
100 #region Private Methods
102 private string GetString(int item)
104 ArrayList info = this.GetInfo(item);
106 return info.Count != 0 ? (string)info[0] : null;
109 private int GetInt32(int item)
111 ArrayList info = this.GetInfo(item);
113 return info.Count != 0 ? (int)info[0] : 0;
116 private ArrayList GetInfo(int item)
118 return this.GetInfo(new byte[] { (byte)item });
121 private ArrayList GetInfo(byte[] items)
123 byte[] buffer = this.QueryService(items);
125 return this.ParseQueryInfo(buffer);