1/*- 2 * See the file LICENSE for redistribution information. 3 * 4 * Copyright (c) 2009 Oracle. All rights reserved. 5 * 6 */ 7using System; 8using System.Collections.Generic; 9using System.Text; 10using BerkeleyDB.Internal; 11 12namespace BerkeleyDB { 13 /// <summary> 14 /// A class representing the supported Berkeley DB access methods. 15 /// </summary> 16 public class DatabaseType { 17 /// <summary> 18 /// BTree access method 19 /// </summary> 20 public static readonly DatabaseType BTREE 21 = new DatabaseType(DBTYPE.DB_BTREE); 22 /// <summary> 23 /// Hash access method 24 /// </summary> 25 public static readonly DatabaseType HASH 26 = new DatabaseType(DBTYPE.DB_HASH); 27 /// <summary> 28 /// Recno access method 29 /// </summary> 30 public static readonly DatabaseType RECNO 31 = new DatabaseType(DBTYPE.DB_RECNO); 32 /// <summary> 33 /// Queue access method 34 /// </summary> 35 public static readonly DatabaseType QUEUE 36 = new DatabaseType(DBTYPE.DB_QUEUE); 37 /// <summary> 38 /// Unknown access method 39 /// </summary> 40 public static readonly DatabaseType UNKNOWN 41 = new DatabaseType(DBTYPE.DB_UNKNOWN); 42 43 private BerkeleyDB.Internal.DBTYPE dbtype; 44 45 private DatabaseType(BerkeleyDB.Internal.DBTYPE type) { 46 dbtype = type; 47 } 48 49 internal BerkeleyDB.Internal.DBTYPE getDBTYPE() { 50 return dbtype; 51 } 52 53 /// <summary> 54 /// Convert this instance of DatabaseType to its string representation. 55 /// </summary> 56 /// <returns>A string representation of this instance.</returns> 57 public override string ToString() { 58 switch (dbtype) { 59 case DBTYPE.DB_BTREE: 60 return "BTree"; 61 case DBTYPE.DB_HASH: 62 return "Hash"; 63 case DBTYPE.DB_QUEUE: 64 return "Queue"; 65 case DBTYPE.DB_RECNO: 66 return "Recno"; 67 default: 68 return "Unknown"; 69 } 70 } 71 72 } 73}