Exemple #1
0
 public override void RenameTable(string oldName, string newName)
 {
     oldName.MustNotBeEmpty();
     newName.MustNotBeEmpty();
     Db.ExecuteCommand(string.Format("alter table {0} rename to {1}", PostgresProvider.EscapeIdentifier(oldName),
                                     PostgresProvider.EscapeIdentifier(newName)));
 }
Exemple #2
0
        public void npgsql_test_pagination_strings()
        {
            var    m = new PostgresProvider(Config.SqlServerProviderName);
            string cnt;
            string sel;

            m.MakePaged("select * from test", out sel, out cnt);
            Assert.Equal("select count(*) from test", cnt);
            Assert.Equal(string.Format("select * from test limit @{0} offset @{1}", PreparePagedStatement.TakeParameterName, PreparePagedStatement.SkipParameterName), sel);
        }
Exemple #3
0
        public void Setup()
        {
            var cfg = Config.Reset();

            cfg.GetSettings <EngineSettings>()
            .WithRandomSuffixAppendedToStreamName();

            _provider = new PostgresProvider();
            _provider.Initialize();

            _journalReader = _provider.CreateJournalReader();
            _journalWriter = _provider.CreateJournalWriter(0);

            _serializer = Config.Current.CreateSerializer();
        }
Exemple #4
0
        private Provider GetProvider(DbConnectionTypes connectionType, string connectionString)
        {
            Provider provider;

            switch (connectionType)
            {
            case DbConnectionTypes.MsSql:
                provider = new MsSqlProvider(connectionString);
                break;

            case DbConnectionTypes.Postgres:
                provider = new PostgresProvider(connectionString);
                break;

            case DbConnectionTypes.Oracle:
                provider = new OracleProvider(connectionString);
                break;

            default:
                return(null);
            }

            return(provider);
        }
 public FileRegistry(PostgresProvider postgresProvider)
 {
     this.postgresProvider = postgresProvider;
     Console.WriteLine("[FileRegistry] has been initialized");
 }
Exemple #6
0
 protected override string Escape(string name)
 {
     return(PostgresProvider.EscapeIdentifier(name));
 }
Exemple #7
0
        public override void provider_escape_name()
        {
            var txt = @"""public.test""";

            Assert.Equal(txt, PostgresProvider.EscapeIdentifier("public.test"));
        }
Exemple #8
0
 public void anything_with_dot_will_be_escaped_as_schema_table()
 {
     Assert.Equal("\"public\".\"mytable\"", PostgresProvider.EscapeIdentifier("public.mytable"));
 }
Exemple #9
0
 public void common_escaping()
 {
     Assert.Equal("\"mytable\"", PostgresProvider.EscapeIdentifier("mytable"));
     Assert.Equal("\"my table\"", PostgresProvider.EscapeIdentifier("my table"));
 }
Exemple #10
0
 public void already_escaped_id_are_not_escaped()
 {
     Assert.Equal("\"public.table\"", PostgresProvider.EscapeIdentifier("\"public.table\""));
     Assert.Equal("\"my table\"", PostgresProvider.EscapeIdentifier("\"my table\""));
 }
Exemple #11
0
 protected override string FormatName(string s)
 {
     return(PostgresProvider.EscapeIdentifier(s));
 }
Exemple #12
0
 protected override void WriteColumn(IndexColumn column)
 {
     Builder.Append(PostgresProvider.EscapeIdentifier(column.Name));
 }
Exemple #13
0
 protected override void WriteTableName()
 {
     Builder.Append(PostgresProvider.EscapeIdentifier(Index.TableName));
 }