Skip to content

Commit

Permalink
Case smashing and prefix trimming in the select
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Jan 3, 2025
1 parent b87d8e4 commit dda13b3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tile-join.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ std::vector<std::map<std::string, mvt_value>> get_joined_rows(sqlite3 *db, const
ret.resize(join_keys.size());

// double quotes for table and column identifiers
const char *s = sqlite3_mprintf("select \"%w\", * from \"%w\" where \"%w\" in (",
join_table_column.c_str(), join_table.c_str(), join_table_column.c_str());
const char *s = sqlite3_mprintf("select LOWER(LTRIM(SUBSTR(\"%w\",1,LENGTH(\"%w\")-3),'0')||SUBSTR(\"%w\",-3,3)), * from \"%w\" where LOWER(LTRIM(SUBSTR(\"%w\",1,LENGTH(\"%w\")-3),'0')||SUBSTR(\"%w\",-3,3)) in (",
join_table_column.c_str(), join_table_column.c_str(), join_table_column.c_str(),
join_table.c_str(),
join_table_column.c_str(), join_table_column.c_str(), join_table_column.c_str());
std::string query = s;
sqlite3_free((void *) s);

Expand Down

0 comments on commit dda13b3

Please sign in to comment.