コード例 #1
0
        public void Quote_ArgIsNotAKeyWordButQuoteForced_ArgMustBeQuoted(string quoteArg)
        {
            var actual   = new FirebirdQuoter(true).Quote(quoteArg);
            var expected = $"\"{quoteArg}\"";

            actual.ShouldBe(expected);
        }
コード例 #2
0
        public void Quote_ArgIsFirebirdKeyword_ArgShouldBeQuoted(string quoteArg)
        {
            var actual   = new FirebirdQuoter(false).Quote(quoteArg);
            var expected = String.Format("\"{0}\"", quoteArg);

            actual.ShouldBe(expected);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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]));
        }
コード例 #5
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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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));
            }
        }
コード例 #9
0
        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));
            }
        }
コード例 #10
0
 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();
 }
コード例 #11
0
        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));
            }
        }
コード例 #12
0
        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]));
        }
コード例 #13
0
 public FirebirdTableSchema(string tableName, FirebirdProcessor processor, FirebirdQuoter quoter)
 {
     _quoter    = quoter;
     TableName  = tableName;
     Processor  = processor;
     Definition = new FirebirdTableDefinition()
     {
         Name       = tableName,
         SchemaName = String.Empty
     };
     Load();
 }
コード例 #14
0
        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);
        }
コード例 #15
0
        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();
        }
コード例 #16
0
        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>();
        }
コード例 #17
0
        public void Quote_ArgBeginsWithUnderscore_ArgShouldBeQuoted(string quoteArg)
        {
            var actual = new FirebirdQuoter(false).Quote(quoteArg);

            actual.ShouldBe(string.Format("\"{0}\"", quoteArg));
        }
コード例 #18
0
        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));
        }
コード例 #19
0
        public void Quote_ArgIsNotAKeyWord_ArgShouldNotBeQuoted(string quoteArg)
        {
            var actual = new FirebirdQuoter(false, new OptionsWrapper <QuoterOptions>(new QuoterOptions())).Quote(quoteArg);

            actual.ShouldBe(quoteArg);
        }
コード例 #20
0
        public void Quote_ArgIsNotAKeyWord_ArgShouldNotBeQuoted(string quoteArg)
        {
            var actual = new FirebirdQuoter(false).Quote(quoteArg);

            actual.ShouldBe(quoteArg);
        }
コード例 #21
0
        public void Quote_PassesTurkishTest()
        {
            var actual = new FirebirdQuoter(false, new OptionsWrapper <QuoterOptions>(new QuoterOptions())).Quote("similar");

            actual.ShouldBe("\"similar\"");
        }
コード例 #22
0
        public void Quote_PassesTurkishTest()
        {
            var actual = new FirebirdQuoter(false).Quote("similar");

            actual.ShouldBe("\"similar\"");
        }
コード例 #23
0
 public FirebirdSchemaProvider(FirebirdProcessor processor, FirebirdQuoter quoter)
 {
     _quoter   = quoter;
     Processor = processor;
 }