Beispiel #1
0
        private NpgsqlConnection GetConnection()
        {
            if (_connection == null)
            {
                _connection = new NpgsqlConnection("Server=TestDataLinux;Port=5432;Database=osm;User Id=osmsharp;Password=osmsharp;");
                _connection.Open();

                PostgreSQLSchemaTools.Drop(_connection);
            }
            return(_connection);
        }
        /// <summary>
        /// Initializes this target.
        /// </summary>
        public override void Initialize()
        {
            if (_connection == null)
            {
                _connection = new NpgsqlConnection(_connectionString);
            }
            if (_connection.State != ConnectionState.Open)
            {
                _connection.Open();
            }

            if (_createAndDetectSchema)
            { // creates or detects the tables.
                PostgreSQLSchemaTools.CreateAndDetect(_connection);
            }

            this.CreateNodeTables();
            this.CreateWayTables();
            this.CreateRelationTables();
        }