public static bool EqualsName(this ObjectIdentifier source, SchemaObjectName target) { if (target.SchemaIdentifier == null) { return(Quote.Name(source.GetName()) == Quote.Name(target.BaseIdentifier.Value)); } return(Quote.Name(source.GetSchema()) == Quote.Name(target.SchemaIdentifier.Value) && Quote.Name(source.GetName()) == Quote.Name(target.BaseIdentifier.Value)); }
private void CreateFakeTableDefinition(ObjectIdentifier table) { var fakeTable = new ExecuteStatement(); fakeTable.ExecuteSpecification = new ExecuteSpecification(); var procedureReference = new ProcedureReference(); procedureReference.Name = new SchemaObjectName(); procedureReference.Name.Identifiers.Add("tSQLt".ToIdentifier()); procedureReference.Name.Identifiers.Add("FakeTable".ToIdentifier()); var entity = new ExecutableProcedureReference(); entity.ProcedureReference = new ProcedureReferenceName(); entity.ProcedureReference.ProcedureReference = procedureReference; entity.Parameters.Add( ParametersHelper.CreateStoredProcedureParameter(string.Format("{0}", table.GetSchema()))); entity.Parameters.Add( ParametersHelper.CreateStoredProcedureParameter(string.Format("{0}", table.GetName()))); fakeTable.ExecuteSpecification.ExecutableEntity = entity; _testProcedure.StatementList.Statements.Add(fakeTable); }
public static SchemaObjectName ToSchemaObjectName(this ObjectIdentifier source) { var target = new SchemaObjectName(); target.Identifiers.Add(source.GetSchema().ToScriptDomIdentifier().Quote()); target.Identifiers.Add(source.GetName().ToScriptDomIdentifier().Quote()); return(target); }
public static Identifier ToIdentifier(this ObjectIdentifier source) { var name = source.GetName(); return(new Identifier { Value = name.Quote() }); }
public static LiteralType GetLiteralType(ObjectIdentifier name) { switch (name.GetName()) { case "bigint": case "smallint": case "tinyint": case "int": case "bit": return LiteralType.Integer; case "numeric": case "decimal": case "float": case "real": return LiteralType.Numeric; case "money": case "smallmoney": return LiteralType.Money; case "date": case "datetimeoffset": case "datetime2": case "smalldatetime": case "datetime": case "time": case "char": case "varchar": case "text": case "nchar": case "nvarchar": case "ntext": case "timestamp": case "uniqueidentifier": case "sql_variant": case "xml": return LiteralType.String; case "binary": case "varbinary": case "image": return LiteralType.Binary; } return LiteralType.String; }
public static bool IsNText(ObjectIdentifier name) { switch (name.GetName()) { case "nchar": case "nvarchar": case "ntext": case "xml": return(true); } return(false); }
public static bool IsNText(ObjectIdentifier name) { switch (name.GetName()) { case "nchar": case "nvarchar": case "ntext": case "xml": return true; } return false; }
public static LiteralType GetLiteralType(ObjectIdentifier name) { switch (name.GetName()) { case "bigint": case "smallint": case "tinyint": case "int": case "bit": return(LiteralType.Integer); case "numeric": case "decimal": case "float": case "real": return(LiteralType.Numeric); case "money": case "smallmoney": return(LiteralType.Money); case "date": case "datetimeoffset": case "datetime2": case "smalldatetime": case "datetime": case "time": case "char": case "varchar": case "text": case "nchar": case "nvarchar": case "ntext": case "timestamp": case "uniqueidentifier": case "sql_variant": case "xml": return(LiteralType.String); case "binary": case "varbinary": case "image": return(LiteralType.Binary); } return(LiteralType.String); }
public static string GetSchemaObjectName(this ObjectIdentifier name) { return(string.Format("{0}.{1}", name.GetSchema(), name.GetName())); }