public void Quote_ArgIsNotAKeyWordButQuoteForced_ArgMustBeQuoted(string quoteArg) { var actual = new FirebirdQuoter(true).Quote(quoteArg); var expected = $"\"{quoteArg}\""; actual.ShouldBe(expected); }
public void Quote_ArgIsFirebirdKeyword_ArgShouldBeQuoted(string quoteArg) { var actual = new FirebirdQuoter(false).Quote(quoteArg); var expected = String.Format("\"{0}\"", quoteArg); actual.ShouldBe(expected); }
public void Quote_ArgIsFirebirdKeyword_ArgShouldBeQuoted(string quoteArg) { var actual = new FirebirdQuoter(false, new OptionsWrapper <QuoterOptions>(new QuoterOptions())).Quote(quoteArg); var expected = string.Format("\"{0}\"", quoteArg); actual.ShouldBe(expected); }
public static TableInfo Read(FirebirdProcessor processor, string tableName) { var quoter = new FirebirdQuoter(); var fbTableName = quoter.ToFbObjectName(tableName); return(new TableInfo(processor.Read(query, AdoHelper.FormatValue(fbTableName)).Tables[0].Rows[0])); }
public void Quote_ArgIsNotAKeyWordButQuoteForced_ArgMustBeQuoted(string quoteArg) { var actual = new FirebirdQuoter(true, new OptionsWrapper <QuoterOptions>(new QuoterOptions())).Quote(quoteArg); var expected = $"\"{quoteArg}\""; actual.ShouldBe(expected); }
public void Quote_ArgIsKeywordInLowercase_ArgShouldBeQuoted(string quoteArg) { var argInLowerCase = quoteArg.ToLower(); var actual = new FirebirdQuoter(false, new OptionsWrapper <QuoterOptions>(new QuoterOptions())).Quote(argInLowerCase); var expected = string.Format("\"{0}\"", argInLowerCase); actual.ShouldBe(expected); }
public void Quote_ArgIsKeywordInLowercase_ArgShouldBeQuoted(string quoteArg) { var argInLowerCase = quoteArg.ToLower(); var actual = new FirebirdQuoter().Quote(argInLowerCase); var expected = String.Format("\"{0}\"", argInLowerCase); actual.ShouldBe(expected); }
public static SequenceInfo Read(FirebirdProcessor processor, string sequenceName) { var fbSequenceName = new FirebirdQuoter().ToFbObjectName(sequenceName); using (DataSet ds = processor.Read(query, AdoHelper.FormatValue(fbSequenceName))) { return(new SequenceInfo(ds.Tables[0].Rows[0], processor)); } }
public static SequenceInfo Read(FirebirdProcessor processor, string sequenceName) { var fbSequenceName = new FirebirdQuoter().ToFbObjectName(sequenceName); using (IDataReader ds = processor.Read(query, AdoHelper.FormatValue(fbSequenceName))) { ds.Read(); return(new SequenceInfo(ds, processor)); } }
public FirebirdProcessor(IDbConnection connection, IMigrationGenerator generator, IAnnouncer announcer, IMigrationProcessorOptions options, IDbFactory factory, FirebirdOptions fbOptions) : base(connection, factory, generator, announcer, options) { FBOptions = fbOptions ?? throw new ArgumentNullException(nameof(fbOptions)); _firebirdVersionFunc = new Lazy <Version>(GetFirebirdVersion); _quoter = new FirebirdQuoter(fbOptions.ForceQuote); truncator = new FirebirdTruncator(FBOptions.TruncateLongNames, FBOptions.PackKeyNames); ClearLocks(); ClearDDLFollowers(); }
public static TableInfo Read(FirebirdProcessor processor, string tableName) { var quoter = new FirebirdQuoter(); var fbTableName = quoter.ToFbObjectName(tableName); using (var dr = processor.Read(query, AdoHelper.FormatValue(fbTableName))) { dr.Read(); return(new TableInfo(dr)); } }
public static TableInfo Read(FirebirdProcessor processor, string tableName, FirebirdQuoter quoter) { var fbTableName = quoter.ToFbObjectName(tableName); var table = processor.Read(query, AdoHelper.FormatValue(fbTableName)).Tables[0]; if (table.Rows.Count == 0) { return(new TableInfo(tableName, false)); } return(new TableInfo(table.Rows[0])); }
public FirebirdTableSchema(string tableName, FirebirdProcessor processor, FirebirdQuoter quoter) { _quoter = quoter; TableName = tableName; Processor = processor; Definition = new FirebirdTableDefinition() { Name = tableName, SchemaName = String.Empty }; Load(); }
protected void SetupUndoAlterColumn(AlterColumnExpression expression) { CanUndo = true; FirebirdSchemaProvider schema = new FirebirdSchemaProvider(Processor); FirebirdTableSchema table = schema.GetTableSchema(expression.TableName); var quoter = new FirebirdQuoter(); AlterColumnExpression alter = new AlterColumnExpression() { SchemaName = String.Empty, TableName = expression.TableName, Column = table.Definition.Columns.First(x => x.Name == quoter.ToFbObjectName(expression.Column.Name)) }; UndoExpressions.Add(alter); }
public FirebirdProcessor( [NotNull] FirebirdDbFactory factory, [NotNull] FirebirdGenerator generator, [NotNull] FirebirdQuoter quoter, [NotNull] ILogger <FirebirdProcessor> logger, [NotNull] IOptionsSnapshot <ProcessorOptions> options, [NotNull] IConnectionStringAccessor connectionStringAccessor, [NotNull] FirebirdOptions fbOptions) : base(() => factory.Factory, generator, logger, options.Value, connectionStringAccessor) { FBOptions = fbOptions ?? throw new ArgumentNullException(nameof(fbOptions)); _firebirdVersionFunc = new Lazy <Version>(GetFirebirdVersion); _quoter = quoter; #pragma warning disable 618 truncator = new FirebirdTruncator(FBOptions.TruncateLongNames, FBOptions.PackKeyNames); #pragma warning restore 618 ClearLocks(); ClearDDLFollowers(); }
public void SetUp() { if (!IntegrationTestOptions.Firebird.IsEnabled) { Assert.Ignore(); } _temporaryDatabase = new TemporaryDatabase( IntegrationTestOptions.Firebird, _prober); var serivces = ServiceCollectionExtensions.CreateServices() .ConfigureRunner(builder => builder.AddFirebird()) .AddScoped <IConnectionStringReader>( _ => new PassThroughConnectionStringReader(_temporaryDatabase.ConnectionString)); ServiceProvider = serivces.BuildServiceProvider(); ServiceScope = ServiceProvider.CreateScope(); Processor = ServiceScope.ServiceProvider.GetRequiredService <FirebirdProcessor>(); Quoter = ServiceScope.ServiceProvider.GetRequiredService <FirebirdQuoter>(); }
public void Quote_ArgBeginsWithUnderscore_ArgShouldBeQuoted(string quoteArg) { var actual = new FirebirdQuoter(false).Quote(quoteArg); actual.ShouldBe(string.Format("\"{0}\"", quoteArg)); }
public void Quote_ArgBeginsWithUnderscore_ArgShouldBeQuoted(string quoteArg) { var actual = new FirebirdQuoter(false, new OptionsWrapper <QuoterOptions>(new QuoterOptions())).Quote(quoteArg); actual.ShouldBe(string.Format("\"{0}\"", quoteArg)); }
public void Quote_ArgIsNotAKeyWord_ArgShouldNotBeQuoted(string quoteArg) { var actual = new FirebirdQuoter(false, new OptionsWrapper <QuoterOptions>(new QuoterOptions())).Quote(quoteArg); actual.ShouldBe(quoteArg); }
public void Quote_ArgIsNotAKeyWord_ArgShouldNotBeQuoted(string quoteArg) { var actual = new FirebirdQuoter(false).Quote(quoteArg); actual.ShouldBe(quoteArg); }
public void Quote_PassesTurkishTest() { var actual = new FirebirdQuoter(false, new OptionsWrapper <QuoterOptions>(new QuoterOptions())).Quote("similar"); actual.ShouldBe("\"similar\""); }
public void Quote_PassesTurkishTest() { var actual = new FirebirdQuoter(false).Quote("similar"); actual.ShouldBe("\"similar\""); }
public FirebirdSchemaProvider(FirebirdProcessor processor, FirebirdQuoter quoter) { _quoter = quoter; Processor = processor; }