~ubuntu-branches/ubuntu/saucy/db/saucy-proposed

« back to all changes in this revision

Viewing changes to lang/csharp/src/DatabaseType.cs

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2010-11-05 15:02:09 UTC
  • mfrom: (13.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20101105150209-ppvyn0619pu014xo
Tags: 5.1.19-1ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Pass --build/--host to configure to support cross-building, and don't
    override CC.
  - Disable the Java build when cross-building, for now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-
 
2
 * See the file LICENSE for redistribution information.
 
3
 *
 
4
 * Copyright (c) 2009, 2010 Oracle and/or its affiliates.  All rights reserved.
 
5
 *
 
6
 */
 
7
using System;
 
8
using System.Collections.Generic;
 
9
using System.Text;
 
10
using BerkeleyDB.Internal;
 
11
 
 
12
namespace 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
}
 
 
b'\\ No newline at end of file'