@@ -40,30 +40,51 @@ public static List<object> ParseDatabaseInfo(byte[] buffer)
4040
4141 switch ( type )
4242 {
43- //
44- // Database characteristics
45- //
4643 case IscCodes . isc_info_allocation :
47- // Number of database pages allocated
44+ case IscCodes . isc_info_ods_version :
45+ case IscCodes . isc_info_ods_minor_version :
46+ case IscCodes . isc_info_page_size :
47+ case IscCodes . isc_info_current_memory :
48+ case IscCodes . isc_info_max_memory :
49+ case IscCodes . isc_info_num_buffers :
50+ case IscCodes . isc_info_sweep_interval :
51+ case IscCodes . isc_info_fetches :
52+ case IscCodes . isc_info_marks :
53+ case IscCodes . isc_info_reads :
54+ case IscCodes . isc_info_writes :
55+ case IscCodes . isc_info_backout_count :
56+ case IscCodes . isc_info_delete_count :
57+ case IscCodes . isc_info_expunge_count :
58+ case IscCodes . isc_info_insert_count :
59+ case IscCodes . isc_info_purge_count :
60+ case IscCodes . isc_info_read_idx_count :
61+ case IscCodes . isc_info_read_seq_count :
62+ case IscCodes . isc_info_update_count :
63+ case IscCodes . isc_info_db_size_in_pages :
64+ case IscCodes . isc_info_oldest_transaction :
65+ case IscCodes . isc_info_oldest_active :
66+ case IscCodes . isc_info_oldest_snapshot :
67+ case IscCodes . isc_info_next_transaction :
68+ case IscCodes . isc_info_active_transactions :
69+ case IscCodes . isc_info_active_tran_count :
4870 info . Add ( VaxInteger ( buffer , pos , length ) ) ;
4971 break ;
5072
73+ case IscCodes . isc_info_no_reserve :
74+ case IscCodes . isc_info_forced_writes :
75+ case IscCodes . isc_info_db_read_only :
76+ info . Add ( buffer [ pos ] == 1 ) ;
77+ break ;
78+
79+ case IscCodes . isc_info_user_names :
80+ info . Add ( Encoding2 . Default . GetString ( buffer , pos + 1 , buffer [ pos ] ) ) ;
81+ break ;
82+
5183 case IscCodes . isc_info_base_level :
52- /* Database version (level) number:
53- * - 1 byte containing the number 1
54- * - 1 byte containing the version number
55- */
5684 info . Add ( string . Format ( CultureInfo . CurrentCulture , "{0}.{1}" , buffer [ pos ] , buffer [ pos + 1 ] ) ) ;
5785 break ;
5886
5987 case IscCodes . isc_info_db_id :
60- /* Database file name and site name:
61- * - 1 byte containing the number 2
62- * - 1 byte containing the length, d, of the database file name in bytes
63- * - A string of d bytes, containing the database file name
64- * - 1 byte containing the length, l, of the site name in bytes
65- * - A string of l bytes, containing the site name
66- */
6788 var dbFile = Encoding2 . Default . GetString ( buffer , pos + 2 , buffer [ pos + 1 ] ) ;
6889 var sitePos = pos + 2 + buffer [ pos + 1 ] ;
6990 int siteLength = buffer [ sitePos ] ;
@@ -77,58 +98,11 @@ public static List<object> ParseDatabaseInfo(byte[] buffer)
7798 break ;
7899
79100 case IscCodes . isc_info_implementation :
80- /* Database implementation number:
81- * - 1 byte containing a 1
82- * - 1 byte containing the implementation number
83- * - 1 byte containing a class number, either 1 or 12
84- */
85101 info . Add ( string . Format ( CultureInfo . CurrentCulture , "{0}.{1}.{2}" , buffer [ pos ] , buffer [ pos + 1 ] , buffer [ pos + 2 ] ) ) ;
86102 break ;
87103
88- case IscCodes . isc_info_no_reserve :
89- /* 0 or 1
90- * - 0 indicates space is reserved on each database page for holding
91- * backup versions of modified records [Default]
92- * - 1 indicates no space is reserved for such records
93- */
94- info . Add ( buffer [ pos ] == 1 ? true : false ) ;
95- break ;
96-
97- case IscCodes . isc_info_ods_version :
98- /* ODS major version number
99- * - Databases with different major version numbers have different
100- * physical layouts; a database engine can only access databases
101- * with a particular ODS major version number
102- * - Trying to attach to a database with a different ODS number
103- * results in an error
104- */
105- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
106- break ;
107-
108- case IscCodes . isc_info_ods_minor_version :
109- /* On-disk structure (ODS) minor version number; an increase in a
110- * minor version number indicates a non-structural change, one that
111- * still allows the database to be accessed by database engines with
112- * the same major version number but possibly different minor
113- * version numbers
114- */
115- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
116- break ;
117-
118- case IscCodes . isc_info_page_size :
119- /* Number of bytes per page of the attached database; use with
120- * isc_info_allocation to determine the size of the database
121- */
122- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
123- break ;
124-
125104 case IscCodes . isc_info_isc_version :
126105 case IscCodes . isc_info_firebird_version :
127- /* Version identification string of the database implementation:
128- * - 1 byte containing the number number of message
129- * - 1 byte specifying the length, of the following string
130- * - n bytes containing the string
131- */
132106 var messagePosition = pos ;
133107 var count = buffer [ messagePosition ] ;
134108 for ( var i = 0 ; i < count ; i ++ )
@@ -139,117 +113,6 @@ public static List<object> ParseDatabaseInfo(byte[] buffer)
139113 }
140114 break ;
141115
142- //
143- // Environmental characteristics
144- //
145-
146- case IscCodes . isc_info_current_memory :
147- // Amount of server memory (in bytes) currently in use
148- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
149- break ;
150-
151- case IscCodes . isc_info_forced_writes :
152- /* Number specifying the mode in which database writes are performed
153- * (0 for asynchronous, 1 for synchronous)
154- */
155- info . Add ( buffer [ pos ] == 1 ? true : false ) ;
156- break ;
157-
158- case IscCodes . isc_info_max_memory :
159- /* Maximum amount of memory (in bytes) used at one time since the first
160- * process attached to the database
161- */
162- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
163- break ;
164-
165- case IscCodes . isc_info_num_buffers :
166- // Number of memory buffers currently allocated
167- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
168- break ;
169-
170- case IscCodes . isc_info_sweep_interval :
171- /* Number of transactions that are committed between sweeps to
172- * remove database record versions that are no longer needed
173- */
174- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
175- break ;
176-
177- //
178- // Performance statistics
179- //
180-
181- case IscCodes . isc_info_fetches :
182- // Number of reads from the memory buffer cache
183- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
184- break ;
185-
186- case IscCodes . isc_info_marks :
187- // Number of writes to the memory buffer cache
188- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
189- break ;
190-
191- case IscCodes . isc_info_reads :
192- // Number of page reads
193- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
194- break ;
195-
196- case IscCodes . isc_info_writes :
197- // Number of page writes
198- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
199- break ;
200-
201- //
202- // Database operation counts
203- //
204-
205- case IscCodes . isc_info_backout_count :
206- // Number of removals of a version of a record
207- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
208- break ;
209-
210- case IscCodes . isc_info_delete_count :
211- // Number of database deletes since the database was last attached
212- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
213- break ;
214-
215- case IscCodes . isc_info_expunge_count :
216- /* Number of removals of a record and all of its ancestors, for records
217- * whose deletions have been committed
218- */
219- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
220- break ;
221-
222- case IscCodes . isc_info_insert_count :
223- // Number of inserts into the database since the database was last attached
224- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
225- break ;
226-
227- case IscCodes . isc_info_purge_count :
228- // Number of removals of old versions of fully mature records
229- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
230- break ;
231-
232- case IscCodes . isc_info_read_idx_count :
233- // Number of reads done via an index since the database was last attached
234- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
235- break ;
236-
237- case IscCodes . isc_info_read_seq_count :
238- /* Number of sequential sequential table scans (row reads) done on each
239- * table since the database was last attached
240- */
241- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
242- break ;
243-
244- case IscCodes . isc_info_update_count :
245- // Number of database updates since the database was last attached
246- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
247- break ;
248-
249- //
250- // Misc
251- //
252-
253116 case IscCodes . isc_info_db_class :
254117 var serverClass = VaxInteger ( buffer , pos , length ) ;
255118 if ( serverClass == IscCodes . isc_info_db_class_classic_access )
@@ -261,45 +124,6 @@ public static List<object> ParseDatabaseInfo(byte[] buffer)
261124 info . Add ( "SUPER SERVER" ) ;
262125 }
263126 break ;
264-
265- case IscCodes . isc_info_db_read_only :
266- info . Add ( buffer [ pos ] == 1 ? true : false ) ;
267- break ;
268-
269- case IscCodes . isc_info_db_size_in_pages :
270- // Database size in pages.
271- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
272- break ;
273-
274- case IscCodes . isc_info_oldest_transaction :
275- // Number of oldest transaction
276- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
277- break ;
278-
279- case IscCodes . isc_info_oldest_active :
280- // Number of oldest active transaction
281- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
282- break ;
283-
284- case IscCodes . isc_info_oldest_snapshot :
285- // Number of oldest snapshot transaction
286- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
287- break ;
288-
289- case IscCodes . isc_info_next_transaction :
290- // Number of next transaction
291- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
292- break ;
293-
294- case IscCodes . isc_info_active_transactions :
295- // Number of active transactions
296- info . Add ( VaxInteger ( buffer , pos , length ) ) ;
297- break ;
298-
299- case IscCodes . isc_info_user_names :
300- // Active user name
301- info . Add ( Encoding2 . Default . GetString ( buffer , pos + 1 , buffer [ pos ] ) ) ;
302- break ;
303127 }
304128
305129 pos += length ;
0 commit comments