Exemplo n.º 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)));
 }
Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
 public FileRegistry(PostgresProvider postgresProvider)
 {
     this.postgresProvider = postgresProvider;
     Console.WriteLine("[FileRegistry] has been initialized");
 }
Exemplo n.º 6
0
 protected override string Escape(string name)
 {
     return(PostgresProvider.EscapeIdentifier(name));
 }
Exemplo n.º 7
0
        public override void provider_escape_name()
        {
            var txt = @"""public.test""";

            Assert.Equal(txt, PostgresProvider.EscapeIdentifier("public.test"));
        }
Exemplo n.º 8
0
 public void anything_with_dot_will_be_escaped_as_schema_table()
 {
     Assert.Equal("\"public\".\"mytable\"", PostgresProvider.EscapeIdentifier("public.mytable"));
 }
Exemplo n.º 9
0
 public void common_escaping()
 {
     Assert.Equal("\"mytable\"", PostgresProvider.EscapeIdentifier("mytable"));
     Assert.Equal("\"my table\"", PostgresProvider.EscapeIdentifier("my table"));
 }
Exemplo n.º 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\""));
 }
Exemplo n.º 11
0
 protected override string FormatName(string s)
 {
     return(PostgresProvider.EscapeIdentifier(s));
 }
Exemplo n.º 12
0
 protected override void WriteColumn(IndexColumn column)
 {
     Builder.Append(PostgresProvider.EscapeIdentifier(column.Name));
 }
Exemplo n.º 13
0
 protected override void WriteTableName()
 {
     Builder.Append(PostgresProvider.EscapeIdentifier(Index.TableName));
 }