DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
SchemaInfo.cs
Go to the documentation of this file.
1 //
2 // Copyright 2010-2015 Deveel
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 using System;
18 using System.Globalization;
19 
20 namespace Deveel.Data.Sql.Schemas {
39  public sealed class SchemaInfo : IObjectInfo {
40  private CompareInfo comparer;
41 
47  public SchemaInfo(string name, string type) {
48  if (String.IsNullOrEmpty(name))
49  throw new ArgumentNullException("name");
50 
51  Name = name;
52  Type = type;
53  }
54 
56  get { return DbObjectType.Schema; }
57  }
58 
59 
61  get { return new ObjectName(Name); }
62  }
63 
67  public string Name { get; private set; }
68 
73  public string Type { get; private set; }
74 
79  public string Culture { get; set; }
80 
92  public int Compare(string s1, string s2) {
93  return Compare(s1, s2, false);
94  }
95 
111  public int Compare(string s1, string s2, bool ignoreCase) {
112  var options = ignoreCase ? CompareOptions.OrdinalIgnoreCase : CompareOptions.Ordinal;
113 
114  if (String.IsNullOrEmpty(Culture))
115  return CultureInfo.InvariantCulture.CompareInfo.Compare(s1, s2, options);
116 
117  if (comparer == null)
118  comparer = new CultureInfo(Culture).CompareInfo;
119 
120  return comparer.Compare(s1, s2, options);
121  }
122  }
123 }
int Compare(string s1, string s2)
Compares two strngs given using the culture set in the schema.
Definition: SchemaInfo.cs:92
int Compare(string s1, string s2, bool ignoreCase)
Compares two strngs given using the culture set in the schema.
Definition: SchemaInfo.cs:111
Describes the name of an object within a database.
Definition: ObjectName.cs:44
A user-defined TYPE that holds complex objects in a database column.
SchemaInfo(string name, string type)
Constructs the schema with the given name
Definition: SchemaInfo.cs:47
DbObjectType
The kind of objects that can be handled by a database system and its managers
Definition: DbObjectType.cs:27
Describes the properties of a schema in a database system.
Definition: SchemaInfo.cs:39