internal SqlTable( int id, string name, string alias, string database, string owner, string physicalName, Type objectType, SequenceNameAttribute[] sequenceAttributes, SqlField[] fields, SqlTableType sqlTableType, ISqlExpression[] tableArguments) { _sourceID = id; Name = name; Alias = alias; Database = database; Owner = owner; PhysicalName = physicalName; ObjectType = objectType; _sequenceAttributes = sequenceAttributes; _fields = new ChildContainer <ISqlTableSource, SqlField>(this); _fields.AddRange(fields); foreach (var field in fields) { if (field.Name == "*") { _all = field; _fields.Remove("*"); ((IChild <ISqlTableSource>)_all).Parent = this; break; } } SqlTableType = sqlTableType; TableArguments = tableArguments; }
internal SqlTable( int id, string name, string alias, string database, string owner, string physicalName, Type objectType, SequenceNameAttribute[] sequenceAttributes, SqlField[] fields, SqlTableType sqlTableType, ISqlExpression[] tableArguments) { _sourceID = id; Name = name; Alias = alias; Database = database; Owner = owner; PhysicalName = physicalName; ObjectType = objectType; SequenceAttributes = sequenceAttributes; Fields = new Dictionary <string, SqlField>(); AddRange(fields); foreach (var field in fields) { if (field.Name == "*") { _all = field; Fields.Remove("*"); _all.Table = this; break; } } SqlTableType = sqlTableType; TableArguments = tableArguments; }
internal SqlTable( int id, string?name, string alias, string?server, string?database, string?schema, string?physicalName, Type?objectType, SequenceNameAttribute[]?sequenceAttributes, SqlField[] fields, SqlTableType sqlTableType, ISqlExpression[]?tableArguments, TableOptions tableOptions) { SourceID = id; Name = name; Alias = alias; Server = server; Database = database; Schema = schema; PhysicalName = physicalName; ObjectType = objectType; SequenceAttributes = sequenceAttributes; AddRange(fields); SqlTableType = sqlTableType; TableArguments = tableArguments; TableOptions = tableOptions; }
internal SqlTable( int id, string?expression, string alias, SqlObjectName tableName, Type objectType, SequenceNameAttribute[]?sequenceAttributes, IEnumerable <SqlField> fields, SqlTableType sqlTableType, ISqlExpression[]?tableArguments, TableOptions tableOptions, string?tableID) : this(objectType, id, tableName) { Expression = expression; Alias = alias; SequenceAttributes = sequenceAttributes; ID = tableID; AddRange(fields); SqlTableType = sqlTableType; TableArguments = tableArguments; TableOptions = tableOptions; }
private DicomTagSqlEntry(DicomTag dicomTag, SqlTableType sqlTableType, Column sqlColumn, string fullTextIndexColumnName = null) { DicomTag = dicomTag; SqlTableType = sqlTableType; SqlColumn = sqlColumn; FullTextIndexColumnName = fullTextIndexColumnName; }
private DicomTagSqlEntry(SqlTableType sqlTableType, Column sqlColumn, string fullTextIndexColumnName = null, Column sqlKeyColumn = null, bool isExtendedQueryTag = false) { SqlTableType = sqlTableType; SqlColumn = sqlColumn; FullTextIndexColumnName = fullTextIndexColumnName; SqlKeyColumn = sqlKeyColumn; IsExtendedQueryTag = isExtendedQueryTag; }
public void convert_empty_sequence_to_null() { var input = new string[0]; var tt = new SqlTableType("typeName", new SqlMetaData("ID", SqlDbType.VarChar, 10)); var meta = new[] { new SqlMetaData("ID", SqlDbType.VarChar, 10) }; SqlTable tab = input.ToSqlTable(tt); Assert.IsNotNull(tab, ""); Assert.AreEqual("typeName", tab.TypeName, "TypeName"); Assert.AreEqual(null, tab.Records, "records"); }
public void can_add_null_TableType() { var input = new[] { new { First = 1m }, }; var tt = new SqlTableType("SOME_TYPE", new SqlMetaData("first", SqlDbType.Decimal)); SqlCommand cmd = new SqlCommand(); cmd.AddParameters(new { Res = input.ToSqlTable(tt) }); Assert.AreEqual(1, cmd.Parameters.Count); Assert.AreEqual("@Res", cmd.Parameters[0].ParameterName); Assert.AreEqual(SqlDbType.Structured, cmd.Parameters[0].SqlDbType); Assert.AreEqual("SOME_TYPE", cmd.Parameters[0].TypeName); }
public void can_pass_table_type() { const string sql = @"select c.* from dbo.Currency c join @ids i on i.id = c.id"; var tt = new SqlTableType("dbo.IntType", new Microsoft.SqlServer.Server.SqlMetaData("ID", System.Data.SqlDbType.Int)); using (var cnn = new SqlConnection(mapperTest)) { var ids = new int[] { 1 }.ToSqlTable(tt); var result = cnn.Query(sql, new { ids }).ToList <Currency>(); Assert.IsNotNull(result); Assert.AreEqual(1, result.Count); } }
public void can_map_multiple_properties_with_action_and_index() { var input = new[] { new MultipleProperties { Long = 10L }, new MultipleProperties { Long = 20L }, }; var tt = new SqlTableType("SomeType", new SqlMetaData("Seq", SqlDbType.Int), new SqlMetaData("Long", SqlDbType.BigInt)); var recs = input.ToSqlTable(tt, (record, properties, i) => record.SetInt32(0, i)).ToList(); Assert.AreEqual(2, recs.Count, "Count"); Assert.AreEqual(0, recs[0].GetValue(0)); Assert.AreEqual(10L, recs[0].GetValue(1)); Assert.AreEqual(1, recs[1].GetValue(0)); Assert.AreEqual(20L, recs[1].GetValue(1)); }
public static void GenerateTables(this ISqlGenerator generator, GenerationType generateType, SqlObjectType type, SqlTableType subType) { generator.Generate(generateType, type, subType); }
public void SetCurrent(CallTreeNodeSqlNameSet nameSet, SqlTableType table, bool hasIDList) { CurrentNameSet = nameSet; CurrentTable = table; HasIDList = hasIDList; }
public void SetCurrent(CallTreeNodeSqlNameSet nameSet, SqlTableType table, bool hasIDList) { CurrentNameSet = nameSet; CurrentTable = table; HasIDList = hasIDList; }