You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by as...@apache.org on 2012/04/21 07:55:37 UTC

svn commit: r1328584 - /subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.c

Author: ashod
Date: Sat Apr 21 05:55:37 2012
New Revision: 1328584

URL: http://svn.apache.org/viewvc?rev=1328584&view=rev
Log:
Pristine.db creation function added.
** Checkpoint: raw code. Not ready for review yet! **

Modified:
    subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.c

Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.c?rev=1328584&r1=1328583&r2=1328584&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.c Sat Apr 21 05:55:37 2012
@@ -1414,6 +1414,50 @@ does_node_exist(svn_boolean_t *exists,
   return svn_error_trace(svn_sqlite__reset(stmt));
 }
 
+/*
+ * ** COMPRESSED PRISTINE **
+ * TODO: moved into separate file.
+ */
+
+/* Create a pristine sqlite database at DIR_ABSPATH/PDB_FNAME and
+   initializes it.  Return the DB connection
+   in *PDB. */
+static svn_error_t *
+create_pristine_db(svn_sqlite__db_t **pdb,
+          const char *dir_abspath,
+          const char *repos_root_url,
+          const char *pdb_fname,
+          apr_pool_t *result_pool,
+          apr_pool_t *scratch_pool)
+{
+  svn_sqlite__stmt_t *stmt;
+  const char **my_statements;
+  int i;
+
+  /* TODO: Sqlite statements must be auto-generated from an SQL file. */
+  /* Temporarily hardcoded here.
+  
+  /* Allocate MY_STATEMENTS in RESULT_POOL because the PDB will continue to
+   * refer to it over its lifetime. */
+  my_statements = apr_palloc(result_pool, 6 * sizeof(const char *));
+  i = 0;
+  my_statements[i++] = "PRAGMA encoding = 'UTF-8'; PRAGMA page_size = 1024;";
+  my_statements[i++] = "CREATE TABLE pristine (digest CHAR(40) PRIMARY KEY, data BLOB)";
+  my_statements[i++] = "INSERT INTO pristine (digest, data) VALUES (?, ?)";
+  my_statements[i] = NULL;
+  
+  SVN_ERR(svn_wc__db_util_open_db(pdb, dir_abspath, pdb_fname,
+                                  svn_sqlite__mode_rwcreate,
+                                  my_statements,
+                                  result_pool, scratch_pool));
+
+  /* Initialize the database. */
+  SVN_ERR(svn_sqlite__exec_statements(*pdb, 0)); /* HACK: Use auto-gen consts! */
+  SVN_ERR(svn_sqlite__exec_statements(*pdb, 1)); /* HACK: Use auto-gen consts! */
+
+  return SVN_NO_ERROR;
+}
+
 
 /* Create an sqlite database at DIR_ABSPATH/SDB_FNAME and insert
    records for REPOS_ID (using REPOS_ROOT_URL and REPOS_UUID) into



Re: svn commit: r1328584 - /subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.c

Posted by Greg Stein <gs...@gmail.com>.
On Apr 21, 2012 1:56 AM, <as...@apache.org> wrote:
>
> Author: ashod
> Date: Sat Apr 21 05:55:37 2012
> New Revision: 1328584
>
> URL: http://svn.apache.org/viewvc?rev=1328584&view=rev
> Log:
> Pristine.db creation function added.
> ** Checkpoint: raw code. Not ready for review yet! **

Happy to see a start!

>...
> +/*
> + * ** COMPRESSED PRISTINE **
> + * TODO: moved into separate file.
> + */

We typically use ### for markers of things to come back to. It stands out
better against the background text.

(no other comments, since I know it is just a draft)

>...

Cheers,
-g