DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
TypeResolver.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 
19 namespace Deveel.Data.Types {
20  static class TypeResolver {
21  public static SqlType Resolve(SqlTypeCode typeCode, string typeName, DataTypeMeta[] metadata, ITypeResolver resolver) {
22  if (PrimitiveTypes.IsPrimitive(typeCode))
23  return PrimitiveTypes.Resolve(typeCode, typeName, metadata);
24 
25  if (resolver == null)
26  throw new NotSupportedException(String.Format("Cannot resolve type '{0}' without context.", typeName));
27 
28  var resolveCcontext = new TypeResolveContext(typeCode, typeName, metadata);
29  return resolver.ResolveType(resolveCcontext);
30  }
31  }
32 }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
SqlType ResolveType(TypeResolveContext context)
A long string in the system.
static SqlType Resolve(string typeName, params DataTypeMeta[] args)
static SqlType Resolve(SqlTypeCode typeCode, string typeName, DataTypeMeta[] metadata, ITypeResolver resolver)
Definition: TypeResolver.cs:21
Defines the properties of a specific SQL Type and handles the values compatible.
Definition: SqlType.cs:33
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
static bool IsPrimitive(SqlTypeCode sqlType)