Example #1
0
        private static SQLiteConnection CreateDatabase(string name, string schema)
        {
            string connectionString = $"Data Source={name}";
            var    sqliteConnection = new SQLiteConnection(connectionString);

            sqliteConnection.Open();
            Sqlite.ExecuteCmd(sqliteConnection, schema);
            sqliteConnection.Close();
            return(sqliteConnection);
        }
Example #2
0
        private static void InsertMetadata(SQLiteConnection conn, Metadata metadata)
        {
            var sql = string.Join(
                "; "
                , $"INSERT INTO metadata (name, value) VALUES ('name', '{metadata.name}');"
                , $"INSERT INTO metadata (name, value) VALUES ('description', '{metadata.description}');"
                , $"INSERT INTO metadata (name, value) VALUES ('bounds', '{metadata.bounds}');"
                , $"INSERT INTO metadata (name, value) VALUES ('center', '{metadata.center}');"
                , $"INSERT INTO metadata (name, value) VALUES ('minzoom', '{metadata.minzoom}');"
                , $"INSERT INTO metadata (name, value) VALUES ('maxzoom', '{metadata.maxzoom}');"
                , $"INSERT INTO metadata (name, value) VALUES ('json', '{metadata.json}');"
                , $"INSERT INTO metadata (name, value) VALUES ('version', '{metadata.version}');"
                , $"INSERT INTO metadata (name, value) VALUES ('type', '{metadata.type}');"
                , "INSERT INTO metadata (name, value) VALUES ('format', 'pbf');"
                );

            Sqlite.ExecuteCmd(conn, sql);
        }