This commit is contained in:
Jerry Liang 2019-08-19 10:49:37 -07:00
Родитель 0d95c8ef89
Коммит eeabd52353
5 изменённых файлов: 218 добавлений и 195 удалений

28
.vscode/settings.json поставляемый
Просмотреть файл

@ -1,24 +1,28 @@
{
"cSpell.words": [
"SQLDB",
"Cmds",
"ltrim",
"rtrim",
"stdev",
"stdevp",
"transpiled",
"transpiler",
"transpiling",
"equijoin",
"ANTLR"
],
"cSpell.ignoreWords": [
"dbsql",
"ISQLDB",
"cond",
"conds",
"npipe",
"octestdb",
"transpiled",
"transpiler",
"transpiling",
"Cmds",
"ltrim",
"rtrim",
"stdev",
"stdevp",
"nvarchar",
"ISNULL",
"equijoin"
],
"cSpell.ignoreWords": [
"dbsql"
"repos",
"RDBMS",
"opencode"
]
}

Просмотреть файл

@ -22,15 +22,22 @@ The library, written in [.Net Core](https://dotnet.microsoft.com/download), is c
## Using the library
```CSharp
// To Be Provided
```
## Build on top of this library
```CSharp
// To Be Provided
var cypherQueryText = @"
MATCH (d:device)-[:belongsTo]->(t:tenant)
MATCH (d)-[:runs]->(a:app)
RETURN t.id as TenantId, a.AppName as AppName, COUNT(d) as DeviceCount
";
var graphDef = new SimpleProvider();
var plan = LogicalPlan.ProcessQueryTree(OpenCypherParser.Parse(cypherQueryText), graphDef);
var sqlRender = new SQLRenderer(graphDef);
var tSqlQuery = sqlRender.RenderPlan(plan);
Console.WriteLine("Transpiled T-SQL query:");
Console.WriteLine(tSqlQuery);
```
See the full examples in [examples](docs/examples) folder.
## Test designs
@ -46,9 +53,8 @@ dotnet test
### Current work in Progress
* Publish NuGet packages
* Update docs and helps
* Inline conditions with node labels (e.g. MATCH (n:))
* list, collect, UNWIND support
* List, collect, UNWIND support
### Issues to address on the horizon
* MATCH pattern with unspecified labels or label patterns maps to more than a single label/relationship type

Просмотреть файл

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using openCypherTranspiler.Common.GraphSchema;
using openCypherTranspiler.LogicalPlanner;
using openCypherTranspiler.openCypherParser;
@ -8,6 +9,14 @@ using openCypherTranspiler.SQLRenderer;
namespace Simple
{
public static class StringHelper
{
public static string StripMargin(this string s)
{
return Regex.Replace(s, @"[ \t]+\|", string.Empty);
}
}
class Program
{
class SimpleProvider : ISQLDBSchemaProvider
@ -150,11 +159,14 @@ namespace Simple
static void Main(string[] args)
{
// To run this program directly after build, in shell, type:
// dotnet run bin/Debug/netcoreapp2.1/simple.dll
var cypherQueryText = @"
MATCH (d:device)-[:belongsTo]->(t:tenant)
MATCH (d)-[:runs]->(a:app)
RETURN t.id as TenantId, a.AppName as AppName, COUNT(d) as DeviceCount
";
|MATCH (d:device)-[:belongsTo]->(t:tenant)
|MATCH (d)-[:runs]->(a:app)
|RETURN t.id as TenantId, a.AppName as AppName, COUNT(d) as DeviceCount
".StripMargin();
Console.WriteLine("Input openCypher Query:");
Console.WriteLine(cypherQueryText);

Просмотреть файл

@ -25,7 +25,7 @@ namespace openCypherTranspiler.LogicalPlanner
{
private ILoggable _logger;
public LogicalPlan(ILoggable logger)
public LogicalPlan(ILoggable logger = null)
{
_logger = logger;
}

Просмотреть файл

@ -53,53 +53,53 @@ namespace openCypherTranspiler.SQLRenderer
// Map from operator type for CAST statement when need arises in some situlations such as CASE WHEN
private static readonly IDictionary<Type, SqlDbType> TypeToSQLTypeMapping = new Dictionary<Type, SqlDbType>()
{
// https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-data-type-mappings
{ typeof(int), SqlDbType.Int},
{ typeof(short), SqlDbType.SmallInt},
{ typeof(long), SqlDbType.BigInt},
{ typeof(double), SqlDbType.Float},
{ typeof(string), SqlDbType.NVarChar},
{ typeof(float), SqlDbType.Float},
{ typeof(DateTime), SqlDbType.DateTime2}, // https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetime-transact-sql?view=sql-server-2017
{ typeof(bool), SqlDbType.Bit},
{ typeof(Guid), SqlDbType.UniqueIdentifier},
{ typeof(uint), SqlDbType.Int},
{ typeof(ushort), SqlDbType.SmallInt},
{ typeof(ulong), SqlDbType.BigInt},
{ typeof(byte), SqlDbType.TinyInt},
{ typeof(byte[]), SqlDbType.Binary},
{ typeof(decimal), SqlDbType.Decimal},
};
{
// https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-data-type-mappings
{ typeof(int), SqlDbType.Int},
{ typeof(short), SqlDbType.SmallInt},
{ typeof(long), SqlDbType.BigInt},
{ typeof(double), SqlDbType.Float},
{ typeof(string), SqlDbType.NVarChar},
{ typeof(float), SqlDbType.Float},
{ typeof(DateTime), SqlDbType.DateTime2}, // https://docs.microsoft.com/en-us/sql/t-sql/data-types/datetime-transact-sql?view=sql-server-2017
{ typeof(bool), SqlDbType.Bit},
{ typeof(Guid), SqlDbType.UniqueIdentifier},
{ typeof(uint), SqlDbType.Int},
{ typeof(ushort), SqlDbType.SmallInt},
{ typeof(ulong), SqlDbType.BigInt},
{ typeof(byte), SqlDbType.TinyInt},
{ typeof(byte[]), SqlDbType.Binary},
{ typeof(decimal), SqlDbType.Decimal},
};
private static readonly IDictionary<SqlDbType, string> SQLTypeRenderingMapping = new Dictionary<SqlDbType, string>()
{
// Doc: https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-data-type-mappings
{ SqlDbType.Int, "int" },
{ SqlDbType.SmallInt, "smallint" },
{ SqlDbType.BigInt, "bigint" },
{ SqlDbType.Float, "float" },
{ SqlDbType.NVarChar, "nvarchar(MAX)" },
{ SqlDbType.DateTime2, "datetime2" },
{ SqlDbType.Bit, "bit"},
{ SqlDbType.UniqueIdentifier, "uniqueidentifier" },
{ SqlDbType.TinyInt, "tinyint" },
{ SqlDbType.Binary, "binary" },
{ SqlDbType.Decimal, "decimal" },
};
{
// Doc: https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-data-type-mappings
{ SqlDbType.Int, "int" },
{ SqlDbType.SmallInt, "smallint" },
{ SqlDbType.BigInt, "bigint" },
{ SqlDbType.Float, "float" },
{ SqlDbType.NVarChar, "nvarchar(MAX)" },
{ SqlDbType.DateTime2, "datetime2" },
{ SqlDbType.Bit, "bit"},
{ SqlDbType.UniqueIdentifier, "uniqueidentifier" },
{ SqlDbType.TinyInt, "tinyint" },
{ SqlDbType.Binary, "binary" },
{ SqlDbType.Decimal, "decimal" },
};
// Map from Aggregation Function to its equivalent in SQL
private static readonly IDictionary<AggregationFunction, string> AggregationFunctionRenderPattern = new Dictionary<AggregationFunction, string>()
{
{ AggregationFunction.Avg, "AVG(CAST({0} AS float))"},
{ AggregationFunction.Sum, "SUM({0})"},
{ AggregationFunction.Min, "MIN({0})"},
{ AggregationFunction.Max, "MAX({0})"},
{ AggregationFunction.First, "MIN({0})"},
{ AggregationFunction.Last, "MAX({0})"},
{ AggregationFunction.StDev, "STDEV({0})" },
{ AggregationFunction.StDevP, "STDEVP({0})" },
};
{
{ AggregationFunction.Avg, "AVG(CAST({0} AS float))"},
{ AggregationFunction.Sum, "SUM({0})"},
{ AggregationFunction.Min, "MIN({0})"},
{ AggregationFunction.Max, "MAX({0})"},
{ AggregationFunction.First, "MIN({0})"},
{ AggregationFunction.Last, "MAX({0})"},
{ AggregationFunction.StDev, "STDEV({0})" },
{ AggregationFunction.StDevP, "STDEVP({0})" },
};
enum ConversionType
{
@ -110,130 +110,131 @@ namespace openCypherTranspiler.SQLRenderer
}
private static readonly IDictionary<(SqlDbType, SqlDbType), ConversionType> SQLTypeConversionType = new Dictionary<(SqlDbType, SqlDbType), ConversionType>()
{
// Doc: https://docs.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-2017
{ (SqlDbType.Int, SqlDbType.Int), ConversionType.NoNeed },
{ (SqlDbType.Int, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.Int, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.Int, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.SmallInt), ConversionType.NoNeed },
{ (SqlDbType.SmallInt, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.SmallInt, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.SmallInt, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.BigInt), ConversionType.NoNeed },
{ (SqlDbType.BigInt, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.BigInt, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.BigInt, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.Float), ConversionType.NoNeed },
{ (SqlDbType.Float, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.Float, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.Float, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.NVarChar), ConversionType.NoNeed },
{ (SqlDbType.NVarChar, SqlDbType.DateTime2), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.UniqueIdentifier), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.Binary), ConversionType.Convert },
{ (SqlDbType.NVarChar, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.DateTime2, SqlDbType.Int), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.SmallInt), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.BigInt), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.Float), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.DateTime2, SqlDbType.DateTime2), ConversionType.NoNeed },
{ (SqlDbType.DateTime2, SqlDbType.Bit), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.TinyInt), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.Binary), ConversionType.Convert },
{ (SqlDbType.DateTime2, SqlDbType.Decimal), ConversionType.Invalid },
{ (SqlDbType.Bit, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.Bit, SqlDbType.Bit), ConversionType.NoNeed },
{ (SqlDbType.Bit, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.Bit, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.UniqueIdentifier, SqlDbType.Int), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.SmallInt), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.BigInt), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.Float), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.UniqueIdentifier, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.Bit), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.UniqueIdentifier), ConversionType.NoNeed },
{ (SqlDbType.UniqueIdentifier, SqlDbType.TinyInt), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.UniqueIdentifier, SqlDbType.Decimal), ConversionType.Invalid },
{ (SqlDbType.TinyInt, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.TinyInt, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.TinyInt, SqlDbType.TinyInt), ConversionType.NoNeed },
{ (SqlDbType.TinyInt, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.Float), ConversionType.Invalid },
{ (SqlDbType.Binary, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.DateTime2), ConversionType.Convert },
{ (SqlDbType.Binary, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.UniqueIdentifier), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.Binary), ConversionType.NoNeed },
{ (SqlDbType.Binary, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.Decimal, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.Decimal, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.Decimal), ConversionType.Cast },
};
{
// Doc: https://docs.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-2017
{ (SqlDbType.Int, SqlDbType.Int), ConversionType.NoNeed },
{ (SqlDbType.Int, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.Int, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.Int, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.Int, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.SmallInt), ConversionType.NoNeed },
{ (SqlDbType.SmallInt, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.SmallInt, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.SmallInt, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.SmallInt, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.BigInt), ConversionType.NoNeed },
{ (SqlDbType.BigInt, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.BigInt, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.BigInt, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.BigInt, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.Float), ConversionType.NoNeed },
{ (SqlDbType.Float, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.Float, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.Float, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.Float, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.NVarChar), ConversionType.NoNeed },
{ (SqlDbType.NVarChar, SqlDbType.DateTime2), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.UniqueIdentifier), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.NVarChar, SqlDbType.Binary), ConversionType.Convert },
{ (SqlDbType.NVarChar, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.DateTime2, SqlDbType.Int), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.SmallInt), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.BigInt), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.Float), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.DateTime2, SqlDbType.DateTime2), ConversionType.NoNeed },
{ (SqlDbType.DateTime2, SqlDbType.Bit), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.TinyInt), ConversionType.Invalid },
{ (SqlDbType.DateTime2, SqlDbType.Binary), ConversionType.Convert },
{ (SqlDbType.DateTime2, SqlDbType.Decimal), ConversionType.Invalid },
{ (SqlDbType.Bit, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.Bit, SqlDbType.Bit), ConversionType.NoNeed },
{ (SqlDbType.Bit, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.Bit, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.Bit, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.UniqueIdentifier, SqlDbType.Int), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.SmallInt), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.BigInt), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.Float), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.UniqueIdentifier, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.Bit), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.UniqueIdentifier), ConversionType.NoNeed },
{ (SqlDbType.UniqueIdentifier, SqlDbType.TinyInt), ConversionType.Invalid },
{ (SqlDbType.UniqueIdentifier, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.UniqueIdentifier, SqlDbType.Decimal), ConversionType.Invalid },
{ (SqlDbType.TinyInt, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.TinyInt, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.TinyInt, SqlDbType.TinyInt), ConversionType.NoNeed },
{ (SqlDbType.TinyInt, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.TinyInt, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.Float), ConversionType.Invalid },
{ (SqlDbType.Binary, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.DateTime2), ConversionType.Convert },
{ (SqlDbType.Binary, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.UniqueIdentifier), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.Binary, SqlDbType.Binary), ConversionType.NoNeed },
{ (SqlDbType.Binary, SqlDbType.Decimal), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.Int), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.SmallInt), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.BigInt), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.Float), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.NVarChar), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.DateTime2), ConversionType.Invalid },
{ (SqlDbType.Decimal, SqlDbType.Bit), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.UniqueIdentifier), ConversionType.Invalid },
{ (SqlDbType.Decimal, SqlDbType.TinyInt), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.Binary), ConversionType.Cast },
{ (SqlDbType.Decimal, SqlDbType.Decimal), ConversionType.Cast },
};
class ExpressionRenderingContext
{
@ -271,8 +272,8 @@ namespace openCypherTranspiler.SQLRenderer
/// <param name="logger">Optional. For logging</param>
public SQLRenderer
(
ISQLDBSchemaProvider graphDef,
ILoggable logger = null
ISQLDBSchemaProvider graphDef,
ILoggable logger = null
)
{
_graphDef = graphDef;