sql: Use SQLite API instead of PRAGMA to check for column existence.

sql::Database::DoesColumnExist currently compiles and runs a "PRAGMA
table_info" [1] SQL query and iterates over the result looking for
the desired column name. This is more brittle and expensive than using
the the sqlite3_table_column_metadata() [2] API, which pulls schema data
directly, bypassing query compilation and execution.

This CL introduces a behavior change -- the previous PRAGMA table_info
implementation works for views [3, 4], whereas
sqlite3_table_column_metadata() only works for tables. The behavior
change is not visible, because Chrome currently uses views in a single
feature [5], namely extensions [6].

DoesColumnExist should only be used for migrations, which should operate
on concrete tables. In steady-state, each feature should have the
database schema migrated to the current version, so column existence is
known statically. So, removing support for views in DoesColumnExist() is
acceptable.

[1] https://www.sqlite.org/pragma.html#pragma_table_info
[2] https://www.sqlite.org/c3ref/table_column_metadata.html
[3] https://www.sqlite.org/matrix/pragma.html
[4] https://www.sqlite.org/matrix/matrix_dpragma.html#R-35224-32827-55933-44478-17553-06933-55583-57822
[5] https://cs.chromium.org/search/?q=file:%5C.cc+sql::+VIEW+case:yes
[6] https://cs.chromium.org/chromium/src/chrome/browser/extensions/activity_log/counting_policy.cc?q=VIEW+case:yes

Bug: 910955
Change-Id: I44474585e6bb2523b5cd91c76c3444058822e601
Reviewed-on: https://chromium-review.googlesource.com/c/1357825
Reviewed-by: Chris Mumford <[email protected]>
Commit-Queue: Victor Costan <[email protected]>
Cr-Commit-Position: refs/heads/master@{#614663}
2 files changed