Commit fac7fe86 authored by Yuanle Song's avatar Yuanle Song
Browse files

v0.3.1 extra select is required to do dedup.

otherwise the group by command only applies to the 2nd SQL.
parent 732801da
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
# -*- mode: conf -*-
project('zero-pinyin-service', ['c', 'cpp'],
  version: '0.3.0',
  version: '0.3.1',
  license: 'GPL',
  default_options: [
    'warning_level=2',
+1 −1
Original line number Diff line number Diff line
@@ -2,5 +2,5 @@
sqlite3 -echo \
	-cmd '.headers on' \
	-cmd '.prompt "zerodb> " "   ...> "' \
	-cmd 'attach "/usr/share/pyzy/db/open-phrase.db" as "maindb"; attach "/home/sylecn/.cache/ibus/pinyin/user-1.0.db" as "userdb";' \
	-cmd 'attach "/home/sylecn/.cache/ibus/pinyin/main.db" as "maindb"; attach "/home/sylecn/.cache/ibus/pinyin/user-1.0.db" as "userdb";' \
	':memory:'
+2 −2
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ build_sql_for_n_pinyin (GList* pylist,
	/* always keep one space after current term */
	GString* sql = NULL;
	gchar* where_clause = NULL;
	sql = g_string_new (NULL);
	sql = g_string_new ("SELECT MAX(user_freq), phrase, MAX(freq) FROM (");
	g_string_append_printf (
		sql, "SELECT 0 AS user_freq, phrase, freq FROM "
		"maindb.py_phrase_%u WHERE ", n - 1);
@@ -101,7 +101,7 @@ build_sql_for_n_pinyin (GList* pylist,
		sql, "SELECT user_freq, phrase, freq FROM "
		"userdb.py_phrase_%u WHERE ", n - 1);
	sql = g_string_append (sql, where_clause);
	sql = g_string_append (sql, "GROUP BY phrase ORDER BY user_freq DESC, freq DESC ");
	sql = g_string_append (sql, ") GROUP BY phrase ORDER BY user_freq DESC, freq DESC ");
	g_string_append_printf (sql, "LIMIT %u;", limit);
	char* result = sql->str;
	g_free (where_clause);