You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2014/02/11 12:41:56 UTC

svn commit: r1567064 - /subversion/trunk/subversion/libsvn_subr/sqlite.c

Author: rhuijben
Date: Tue Feb 11 11:41:56 2014
New Revision: 1567064

URL: http://svn.apache.org/r1567064
Log:
* subversion/libsvn_subr/sqlite.c
  (svn_sqlite__open): Explicitly set some sqlite defaults to avoid packagers
    to accidentally enable unexpected behavior via 'harmless' global sqlite
    flags. Add compiletime option for diagnosing some sqlite usage problems.

Modified:
    subversion/trunk/subversion/libsvn_subr/sqlite.c

Modified: subversion/trunk/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sqlite.c?rev=1567064&r1=1567063&r2=1567064&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/trunk/subversion/libsvn_subr/sqlite.c Tue Feb 11 11:41:56 2014
@@ -1162,7 +1162,13 @@ svn_sqlite__open(svn_sqlite__db_t **db, 
               /* Enable recursive triggers so that a user trigger will fire
                  in the deletion phase of an INSERT OR REPLACE statement.
                  Requires SQLite >= 3.6.18  */
-              "PRAGMA recursive_triggers=ON;"));
+              "PRAGMA recursive_triggers=ON;"
+              /* Enforce current Sqlite default behavior. Some distributions
+                 might change the Sqlite defaults without realizing how this
+                 affects application(read: Subversion) performance/behavior. */
+              "PRAGMA foreign_keys=OFF;"      /* SQLITE_DEFAULT_FOREIGN_KEYS*/
+              "PRAGMA locking_mode = NORMAL;" /* SQLITE_DEFAULT_LOCKING_MODE */
+              ));
 
 #if defined(SVN_DEBUG)
   /* When running in debug mode, enable the checking of foreign key
@@ -1171,6 +1177,14 @@ svn_sqlite__open(svn_sqlite__db_t **db, 
   SVN_ERR(exec_sql(*db, "PRAGMA foreign_keys=ON;"));
 #endif
 
+#ifdef SVN_SQLITE_REVERSE_UNORDERED_SELECTS
+  /* When enabled, this PRAGMA causes SELECT statements without an ORDER BY
+     clause to emit their results in the reverse order of what they normally
+     would.  This can help detecting invalid assumptions about the result
+     order.*/
+  SVN_ERR(exec_sql(*db, "PRAGMA reverse_unordered_selects=ON;"));
+#endif
+
   /* Store temporary tables in RAM instead of in temporary files, but don't
      fail on this if this option is disabled in the sqlite compilation by
      setting SQLITE_TEMP_STORE to 0 (always to disk) */