18 using System.Collections.Generic;
23 namespace Deveel.Data.Sql.Parser {
28 throw new ArgumentException();
30 var typeName = node.TypeName;
31 var typeMeta =
new List<DataTypeMeta>();
34 if (node.IsPrimitive) {
35 if (
String.Equals(typeName,
"LONG VARCHAR")) {
37 }
else if (
String.Equals(node.TypeName,
"LONG VARBINARY")) {
39 }
else if (
String.Equals(typeName,
"INT", StringComparison.OrdinalIgnoreCase)) {
55 typeMeta.Add(
new DataTypeMeta(
"Scale", node.Scale.ToString()));
56 if (node.HasPrecision)
57 typeMeta.Add(
new DataTypeMeta(
"Precision", node.Precision.ToString()));
62 typeMeta.Add(
new DataTypeMeta(
"MaxSize", node.Size.ToString()));
66 typeMeta.Add(
new DataTypeMeta(
"Encoding", node.Encoding));
71 typeMeta.Add(
new DataTypeMeta(
"MaxSize", node.Size.ToString()));
79 if (
String.IsNullOrEmpty(typeName))
83 if (!node.IsPrimitive && node.Metadata != null)
84 meta = BuildTypeMeta(node.Metadata);
95 return metadata.Select(x =>
new DataTypeMeta(x.Key, x.Value)).ToArray();
A long string in the system.
Defines the contract for nodes in an AST model for a SQL grammar analysis and parsing.
static SqlType Resolve(SqlTypeCode typeCode, string typeName, DataTypeMeta[] metadata, ITypeResolver resolver)
static DataTypeMeta[] BuildTypeMeta(Dictionary< string, string > metadata)
static SqlType Build(ITypeResolver resolver, ISqlNode sqlNode)
Defines the properties of a specific SQL Type and handles the values compatible.
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Describes the information of a data type as found in a SQL string.
An error that occurs when compiling a input string into a SQL object.