subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject svn commit: r904968 - in /subversion/trunk/subversion: include/private/svn_sqlite.h libsvn_subr/sqlite.c
Date Sun, 31 Jan 2010 03:47:25 GMT
Author: gstein
Date: Sun Jan 31 03:47:25 2010
New Revision: 904968

URL: http://svn.apache.org/viewvc?rev=904968&view=rev
Log:
Add a enw entrypoint for executing a series of statements.

Minor tweak to skip the auto-upgrade process, if the upgrade statements
were not provided.

* subversion/include/private/svn_sqlite.h:
  (svn_sqlite__exec_statements): run all the statements in a given
    statement string.

* subversion/libsvn_subr/sqlite.c:
  (svn_sqlite__exec_statements): run the statements
  (svn_sqlite__open): skip auto-upgrade if UPGRADE_SQL is NULL

Modified:
    subversion/trunk/subversion/include/private/svn_sqlite.h
    subversion/trunk/subversion/libsvn_subr/sqlite.c

Modified: subversion/trunk/subversion/include/private/svn_sqlite.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_sqlite.h?rev=904968&r1=904967&r2=904968&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_sqlite.h (original)
+++ subversion/trunk/subversion/include/private/svn_sqlite.h Sun Jan 31 03:47:25 2010
@@ -120,6 +120,10 @@
 svn_error_t *
 svn_sqlite__close(svn_sqlite__db_t *db);
 
+/* Execute the (multiple) statements in the STATEMENTS[STMT_IDX] string.  */
+svn_error_t *
+svn_sqlite__exec_statements(svn_sqlite__db_t *db, int stmt_idx);
+
 /* Returns the statement in *STMT which has been prepared from the
    STATEMENTS[STMT_IDX] string.  This statement is allocated in the same
    pool as the DB, and will be cleaned up with DB is closed. */

Modified: subversion/trunk/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sqlite.c?rev=904968&r1=904967&r2=904968&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/trunk/subversion/libsvn_subr/sqlite.c Sun Jan 31 03:47:25 2010
@@ -117,6 +117,16 @@
   return SVN_NO_ERROR;
 }
 
+
+svn_error_t *
+svn_sqlite__exec_statements(svn_sqlite__db_t *db, int stmt_idx)
+{
+  SVN_ERR_ASSERT(stmt_idx < db->nbr_statements);
+
+  return svn_error_return(exec_sql(db, db->statement_strings[stmt_idx]));
+}
+
+
 svn_error_t *
 svn_sqlite__get_statement(svn_sqlite__stmt_t **stmt, svn_sqlite__db_t *db,
                           int stmt_idx)
@@ -898,7 +908,8 @@
 #endif
 
   /* Validate the schema, upgrading if necessary. */
-  SVN_ERR(check_format(*db, latest_schema, upgrade_sql, scratch_pool));
+  if (upgrade_sql != NULL)
+    SVN_ERR(check_format(*db, latest_schema, upgrade_sql, scratch_pool));
 
   /* Store the provided statements. */
   if (statements)



Mime
View raw message