public static PreparedStatement createWayTagTable ( Connection connection , String wayTagTableName , String tagTableName ) throws SQLException { try ( Statement stmt = connection . createStatement ( ) ) { StringBuilder sb = new StringBuilder ( "CREATE TABLE " ) ; sb . append ( wayTagTableName ) ; sb . append ( "(ID_WAY BIGINT, ID_TAG BIGINT, VALUE VARCHAR);" ) ; stmt . execute ( sb . toString ( ) ) ; } //We return the preparedstatement of the way tag table StringBuilder insert = new StringBuilder ( "INSERT INTO " ) ; insert . append ( wayTagTableName ) ; insert . append ( "VALUES ( ?, " ) ; insert . append ( "(SELECT ID_TAG FROM " ) . append ( tagTableName ) . append ( " WHERE TAG_KEY = ? LIMIT 1)" ) ; insert . append ( ", ?);" ) ; return connection . prepareStatement ( insert . toString ( ) ) ; }
Create a table to store the way tags .