You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2011/06/27 01:43:29 UTC
svn commit: r1139971 - /subversion/trunk/subversion/libsvn_subr/sqlite.c
Author: danielsh
Date: Sun Jun 26 23:43:28 2011
New Revision: 1139971
URL: http://svn.apache.org/viewvc?rev=1139971&view=rev
Log:
Work around a bug in SQLite 3.7.7.
See this thread for context:
http://mid.gmane.org/BANLkTimDypWGY-8tHFgJsTxN6ty6OkdJ0Q@mail.gmail.com
* subversion/libsvn_subr/sqlite.c
(exec_sql): Rename to exec_sql2. Grow and use IGNORED_ERR parameter.
(exec_sql): New macro wrapper.
(svn_sqlite__open): Ran the CASE_SENSITIVE_LIKE pragma separately, with
special error checking when SQLite is 3.7.7 (exactly).
Found by: arfrever
Suggested by: Richard Hipp <dr...@sqlite.org>
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=1139971&r1=1139970&r2=1139971&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/trunk/subversion/libsvn_subr/sqlite.c Sun Jun 26 23:43:28 2011
@@ -133,13 +133,18 @@ struct svn_sqlite__value_t
} while (0)
+/* Convenience wrapper around exec_sql2(). */
+#define exec_sql(db, sql) exec_sql2((db), (sql), SQLITE_OK)
+
+/* Run the statement SQL on DB, ignoring SQLITE_OK and IGNORED_ERR.
+ (Note: the IGNORED_ERR parameter itself is not ignored.) */
static svn_error_t *
-exec_sql(svn_sqlite__db_t *db, const char *sql)
+exec_sql2(svn_sqlite__db_t *db, const char *sql, int ignored_err)
{
char *err_msg;
int sqlite_err = sqlite3_exec(db->db3, sql, NULL, NULL, &err_msg);
- if (sqlite_err != SQLITE_OK)
+ if (sqlite_err != SQLITE_OK && sqlite_err != ignored_err)
{
svn_error_t *err = svn_error_createf(SQLITE_ERROR_CODE(sqlite_err), NULL,
_("%s, executing statement '%s'"),
@@ -909,8 +914,16 @@ svn_sqlite__open(svn_sqlite__db_t **db,
sqlite3_profile((*db)->db3, sqlite_profiler, (*db)->db3);
#endif
+#if SQLITE_VERSION_AT_LEAST(3,7,7) \
+ && !SQLITE_VERSION_AT_LEAST(3,7,8) \
+ && defined(SQLITE_SCHEMA)
+ /* See message <BA...@mail.gmail.com> on dev@ */
+ SVN_ERR(exec_sql2(*db, "PRAGMA case_sensitive_like=1;", SQLITE_SCHEMA));
+#else
+ SVN_ERR(exec_sql2(*db, "PRAGMA case_sensitive_like=1;", SQLITE_OK));
+#endif /* 3.7.7 && SQLITE_SCHEMA */
+
SVN_ERR(exec_sql(*db,
- "PRAGMA case_sensitive_like=1;"
/* Disable synchronization to disable the explicit disk flushes
that make Sqlite up to 50 times slower; especially on small
transactions.