Bug 734351 - Fix a query syntax error that disallows populating the hosts table.

r=dietrich
This commit is contained in:
Marco Bonardo 2012-03-09 18:05:11 +01:00
parent 951fa09a3f
commit 6e733cc348
2 changed files with 12 additions and 12 deletions

View File

@ -1699,8 +1699,8 @@ Database::MigrateV17Up()
"INSERT OR IGNORE INTO moz_hosts (host, frecency) "
"SELECT fixup_url(get_unreversed_host(h.rev_host)) AS host, "
"(SELECT MAX(frecency) FROM moz_places "
"WHERE rev_host = get_unreversed_host(host || '.') || '.' "
"OR rev_host = get_unreversed_host(host || '.') || '.www.') "
"WHERE rev_host = h.rev_host "
"OR rev_host = h.rev_host || 'www.' "
") AS frecency "
"FROM moz_places h "
"WHERE LENGTH(h.rev_host) > 1 "

View File

@ -292,24 +292,24 @@ function test_moz_hosts()
// check the number of entries in moz_hosts equals the number of
// unique rev_host in moz_places
stmt = DBConn().createAsyncStatement(
"SELECT ("
+ "SELECT COUNT(host) "
+ "FROM moz_hosts), ("
+ "SELECT COUNT(DISTINCT rev_host) "
+ "FROM moz_places "
+ "WHERE LENGTH(rev_host) > 1)"
);
"SELECT (SELECT COUNT(host) FROM moz_hosts), " +
"(SELECT COUNT(DISTINCT rev_host) " +
"FROM moz_places " +
"WHERE LENGTH(rev_host) > 1)");
try {
stmt.executeAsync({
handleResult: function (aResultSet) {
handleResult: function (aResult) {
this._hasResults = true;
let row = aResult.getNextRow();
let mozPlacesCount = row.getResultByIndex(0);
let mozHostsCount = row.getResultByIndex(1);
let mozHostsCount = row.getResultByIndex(0);
let mozPlacesCount = row.getResultByIndex(1);
do_check_true(mozPlacesCount > 0);
do_check_eq(mozPlacesCount, mozHostsCount);
},
handleError: function () {},
handleCompletion: function (aReason) {
do_check_eq(aReason, Ci.mozIStorageStatementCallback.REASON_FINISHED);
do_check_true(this._hasResults);
run_next_test();
}
});