sql: Disable access to views by default for sql::Database users.

The use of SQLite views is discouraged in Chrome feature code.

After this CL lands, accessing views in SQL statements requires setting
DatabaseOptions::enable_views_discouraged to true. This applies to all
Chrome feature code, but not to WebSQL, which uses its own SQLite
abstraction. CREATE VIEW and DROP VIEW will still work, but the views
will not be accessible to SQL statements such as SELECT.

The change will make Chrome feature developers aware when using this
discouraged feature, which is expected to curb usage.

Disabling access to views in Chrome features is the best we can do for
now, because WebSQL still needs SQLite support for views. After we
remove WebSQL, we can remove all view support from SQLite.

Bug: 910955
Change-Id: I9f6c6c40b3a60e9eef4d0e1f07769664d5a9bf4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3015310
Reviewed-by: Reilly Grant <[email protected]>
Reviewed-by: Alex Ilin <[email protected]>
Reviewed-by: Marijn Kruisselbrink <[email protected]>
Commit-Queue: Victor Costan <[email protected]>
Cr-Commit-Position: refs/heads/master@{#903148}
diff --git a/sql/database.h b/sql/database.h
index b692868..ca81a62e 100644
--- a/sql/database.h
+++ b/sql/database.h
@@ -142,11 +142,20 @@
   // pre-compiled SQL statements.
   bool mmap_alt_status_discouraged = false;
 
-  // If true, enables virtual tables (a discouraged feature) for this database.
+  // If true, enables SQL views (a discouraged feature) for this database.
   //
   // The use of views is discouraged for Chrome code. See README.md for details
   // and recommended replacements.
   //
+  // If this option is false, CREATE VIEW and DROP VIEW succeed, but SELECT
+  // statements targeting views fail.
+  bool enable_views_discouraged = false;
+
+  // If true, enables virtual tables (a discouraged feature) for this database.
+  //
+  // The use of virtual tables is discouraged for Chrome code. See README.md for
+  // details and recommended replacements.
+  //
   // If this option is false, CREATE VIRTUAL TABLE and DROP VIRTUAL TABLE
   // succeed, but statements targeting virtual tables fail.
   bool enable_virtual_tables_discouraged = false;